repo_name
stringlengths 2
55
| dataset
stringclasses 1
value | owner
stringlengths 3
31
| lang
stringclasses 10
values | func_name
stringlengths 1
104
| code
stringlengths 20
96.7k
| docstring
stringlengths 1
4.92k
| url
stringlengths 94
241
| sha
stringlengths 40
40
|
|---|---|---|---|---|---|---|---|---|
BugChecker
|
github_2023
|
vitoplantamura
|
cpp
|
BenchmarkVector
|
void BenchmarkVector()
{
EASTLTest_Printf("Vector\n");
EA::UnitTest::RandGenT<uint32_t> rng(EA::UnitTest::GetRandSeed());
EA::StdC::Stopwatch stopwatch1(EA::StdC::Stopwatch::kUnitsCPUCycles);
EA::StdC::Stopwatch stopwatch2(EA::StdC::Stopwatch::kUnitsCPUCycles);
{
eastl::vector<uint32_t> intVector(100000);
eastl::generate(intVector.begin(), intVector.end(), rng);
for(int i = 0; i < 2; i++)
{
StdVectorUint64 stdVectorUint64;
EaVectorUint64 eaVectorUint64;
///////////////////////////////
// Test push_back
///////////////////////////////
TestPushBack(stopwatch1, stdVectorUint64, intVector);
TestPushBack(stopwatch2, eaVectorUint64, intVector);
if(i == 1)
Benchmark::AddResult("vector<uint64>/push_back", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
///////////////////////////////
// Test operator[].
///////////////////////////////
TestBracket(stopwatch1, stdVectorUint64);
TestBracket(stopwatch2, eaVectorUint64);
if(i == 1)
Benchmark::AddResult("vector<uint64>/operator[]", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
///////////////////////////////
// Test iteration via find().
///////////////////////////////
TestFind(stopwatch1, stdVectorUint64);
TestFind(stopwatch2, eaVectorUint64);
TestFind(stopwatch1, stdVectorUint64);
TestFind(stopwatch2, eaVectorUint64);
if(i == 1)
Benchmark::AddResult("vector<uint64>/iteration", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
///////////////////////////////
// Test sort
///////////////////////////////
// Currently VC++ complains about our sort function decrementing std::iterator that is already at begin(). In the strictest sense,
// that's a valid complaint, but we aren't testing std STL here. We will want to revise our sort function eventually.
#if !defined(_MSC_VER) || !defined(_ITERATOR_DEBUG_LEVEL) || (_ITERATOR_DEBUG_LEVEL < 2)
TestSort(stopwatch1, stdVectorUint64);
TestSort(stopwatch2, eaVectorUint64);
if(i == 1)
Benchmark::AddResult("vector<uint64>/sort", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
#endif
///////////////////////////////
// Test insert
///////////////////////////////
TestInsert(stopwatch1, stdVectorUint64);
TestInsert(stopwatch2, eaVectorUint64);
if(i == 1)
Benchmark::AddResult("vector<uint64>/insert", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
///////////////////////////////
// Test erase
///////////////////////////////
TestErase(stopwatch1, stdVectorUint64);
TestErase(stopwatch2, eaVectorUint64);
if(i == 1)
Benchmark::AddResult("vector<uint64>/erase", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
///////////////////////////////////////////
// Test move of MovableType
// Should be much faster with C++11 move.
///////////////////////////////////////////
std::vector<MovableType> stdVectorMovableType;
eastl::vector<MovableType> eaVectorMovableType;
TestMoveReallocate(stopwatch1, stdVectorMovableType);
TestMoveReallocate(stopwatch2, eaVectorMovableType);
if(i == 1)
Benchmark::AddResult("vector<MovableType>/reallocate", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
TestMoveErase(stopwatch1, stdVectorMovableType);
TestMoveErase(stopwatch2, eaVectorMovableType);
if(i == 1)
Benchmark::AddResult("vector<MovableType>/erase", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
///////////////////////////////////////////
// Test move of AutoRefCount
// Should be much faster with C++11 move.
///////////////////////////////////////////
std::vector<AutoRefCount<RefCounted> > stdVectorAutoRefCount;
eastl::vector<AutoRefCount<RefCounted> > eaVectorAutoRefCount;
for(size_t a = 0; a < 2048; a++)
{
stdVectorAutoRefCount.push_back(AutoRefCount<RefCounted>(new RefCounted));
eaVectorAutoRefCount.push_back(AutoRefCount<RefCounted>(new RefCounted));
}
RefCounted::msAddRefCount = 0;
RefCounted::msReleaseCount = 0;
TestMoveErase(stopwatch1, stdVectorAutoRefCount);
EASTLTest_Printf("vector<AutoRefCount>/erase std counts: %d %d\n", RefCounted::msAddRefCount, RefCounted::msReleaseCount);
RefCounted::msAddRefCount = 0;
RefCounted::msReleaseCount = 0;
TestMoveErase(stopwatch2, eaVectorAutoRefCount);
EASTLTest_Printf("vector<AutoRefCount>/erase EA counts: %d %d\n", RefCounted::msAddRefCount, RefCounted::msReleaseCount);
if(i == 1)
Benchmark::AddResult("vector<AutoRefCount>/erase", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
}
}
}
|
// namespace
|
https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/EASTL/benchmark/source/BenchmarkVector.cpp#L301-L440
|
8b81e76efe457b59be3a6e752efd43916ba0cabb
|
LeetCode_DailyChallenge_2023
|
github_2023
|
7oSkaaa
|
cpp
|
Solution.wordBreak
|
bool wordBreak(string s, vector < string >& wordDict) {
// Base case: an empty string can always be segmented (as no word is needed).
if (s.empty()) return true;
// If the result for the current 's' is already computed, return it to avoid recomputation.
if (mp.find(s) != mp.end()) return mp[s];
// Get the size of the word dictionary to use it in the loop.
int n = wordDict.size();
// Loop through the words in the dictionary to find a match with the beginning of 's'.
for (int i = 0; i < n; i++) {
// Check if the current word from the dictionary matches the start of 's'.
if (wordDict[i] == s.substr(0, wordDict[i].length())) {
// If there is a match, recursively check the rest of the string after removing the matched word.
bool check = wordBreak(s.substr(wordDict[i].length()), wordDict);
// If the rest of the string can be segmented, update the result for the current 's' to true.
if (check)
return mp[s] = true;
}
}
// If no match is found, update the result for the current 's' to false.
return mp[s] = false;
}
|
// The wordBreak function takes a string 's' and a vector of strings 'wordDict'.
// It returns true if the string 's' can be segmented into words from 'wordDict', false otherwise.
|
https://github.com/7oSkaaa/LeetCode_DailyChallenge_2023/blob/e00960b9f5cbfaf813572c366e16d4fef5fa6b8d/08- August/04- Word Break/04- Word Break (Ahmed Hossam).cpp#L9-L34
|
e00960b9f5cbfaf813572c366e16d4fef5fa6b8d
|
Whisper
|
github_2023
|
Const-me
|
cpp
|
MurmurHash3_x86_128
|
void MurmurHash3_x86_128( const void* key, const int len,
uint32_t seed, void* out )
{
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16;
uint32_t h1 = seed;
uint32_t h2 = seed;
uint32_t h3 = seed;
uint32_t h4 = seed;
const uint32_t c1 = 0x239b961b;
const uint32_t c2 = 0xab0e9789;
const uint32_t c3 = 0x38b34ae5;
const uint32_t c4 = 0xa1e38b93;
//----------
// body
const uint32_t* blocks = (const uint32_t*)( data + nblocks * 16 );
for( int i = -nblocks; i; i++ )
{
uint32_t k1 = getblock32( blocks, i * 4 + 0 );
uint32_t k2 = getblock32( blocks, i * 4 + 1 );
uint32_t k3 = getblock32( blocks, i * 4 + 2 );
uint32_t k4 = getblock32( blocks, i * 4 + 3 );
k1 *= c1; k1 = ROTL32( k1, 15 ); k1 *= c2; h1 ^= k1;
h1 = ROTL32( h1, 19 ); h1 += h2; h1 = h1 * 5 + 0x561ccd1b;
k2 *= c2; k2 = ROTL32( k2, 16 ); k2 *= c3; h2 ^= k2;
h2 = ROTL32( h2, 17 ); h2 += h3; h2 = h2 * 5 + 0x0bcaa747;
k3 *= c3; k3 = ROTL32( k3, 17 ); k3 *= c4; h3 ^= k3;
h3 = ROTL32( h3, 15 ); h3 += h4; h3 = h3 * 5 + 0x96cd1c35;
k4 *= c4; k4 = ROTL32( k4, 18 ); k4 *= c1; h4 ^= k4;
h4 = ROTL32( h4, 13 ); h4 += h1; h4 = h4 * 5 + 0x32ac3b17;
}
//----------
// tail
const uint8_t* tail = (const uint8_t*)( data + nblocks * 16 );
uint32_t k1 = 0;
uint32_t k2 = 0;
uint32_t k3 = 0;
uint32_t k4 = 0;
switch( len & 15 )
{
case 15: k4 ^= tail[ 14 ] << 16;
case 14: k4 ^= tail[ 13 ] << 8;
case 13: k4 ^= tail[ 12 ] << 0;
k4 *= c4; k4 = ROTL32( k4, 18 ); k4 *= c1; h4 ^= k4;
case 12: k3 ^= tail[ 11 ] << 24;
case 11: k3 ^= tail[ 10 ] << 16;
case 10: k3 ^= tail[ 9 ] << 8;
case 9: k3 ^= tail[ 8 ] << 0;
k3 *= c3; k3 = ROTL32( k3, 17 ); k3 *= c4; h3 ^= k3;
case 8: k2 ^= tail[ 7 ] << 24;
case 7: k2 ^= tail[ 6 ] << 16;
case 6: k2 ^= tail[ 5 ] << 8;
case 5: k2 ^= tail[ 4 ] << 0;
k2 *= c2; k2 = ROTL32( k2, 16 ); k2 *= c3; h2 ^= k2;
case 4: k1 ^= tail[ 3 ] << 24;
case 3: k1 ^= tail[ 2 ] << 16;
case 2: k1 ^= tail[ 1 ] << 8;
case 1: k1 ^= tail[ 0 ] << 0;
k1 *= c1; k1 = ROTL32( k1, 15 ); k1 *= c2; h1 ^= k1;
};
//----------
// finalization
h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
h1 += h2; h1 += h3; h1 += h4;
h2 += h1; h3 += h1; h4 += h1;
h1 = fmix32( h1 );
h2 = fmix32( h2 );
h3 = fmix32( h3 );
h4 = fmix32( h4 );
h1 += h2; h1 += h3; h1 += h4;
h2 += h1; h3 += h1; h4 += h1;
( (uint32_t*)out )[ 0 ] = h1;
( (uint32_t*)out )[ 1 ] = h2;
( (uint32_t*)out )[ 2 ] = h3;
( (uint32_t*)out )[ 3 ] = h4;
}
|
//-----------------------------------------------------------------------------
|
https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/MurmurHash3.cpp#L150-L251
|
306aadd1fce4b168cd38659236f4ba7c1603cebd
|
BetterRenderDragon
|
github_2023
|
ddf8196
|
cpp
|
ImGui_ImplWin32_VirtualKeyToImGuiKey
|
static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey(WPARAM wParam)
{
switch (wParam)
{
case VK_TAB: return ImGuiKey_Tab;
case VK_LEFT: return ImGuiKey_LeftArrow;
case VK_RIGHT: return ImGuiKey_RightArrow;
case VK_UP: return ImGuiKey_UpArrow;
case VK_DOWN: return ImGuiKey_DownArrow;
case VK_PRIOR: return ImGuiKey_PageUp;
case VK_NEXT: return ImGuiKey_PageDown;
case VK_HOME: return ImGuiKey_Home;
case VK_END: return ImGuiKey_End;
case VK_INSERT: return ImGuiKey_Insert;
case VK_DELETE: return ImGuiKey_Delete;
case VK_BACK: return ImGuiKey_Backspace;
case VK_SPACE: return ImGuiKey_Space;
case VK_RETURN: return ImGuiKey_Enter;
case VK_ESCAPE: return ImGuiKey_Escape;
case VK_OEM_7: return ImGuiKey_Apostrophe;
case VK_OEM_COMMA: return ImGuiKey_Comma;
case VK_OEM_MINUS: return ImGuiKey_Minus;
case VK_OEM_PERIOD: return ImGuiKey_Period;
case VK_OEM_2: return ImGuiKey_Slash;
case VK_OEM_1: return ImGuiKey_Semicolon;
case VK_OEM_PLUS: return ImGuiKey_Equal;
case VK_OEM_4: return ImGuiKey_LeftBracket;
case VK_OEM_5: return ImGuiKey_Backslash;
case VK_OEM_6: return ImGuiKey_RightBracket;
case VK_OEM_3: return ImGuiKey_GraveAccent;
case VK_CAPITAL: return ImGuiKey_CapsLock;
case VK_SCROLL: return ImGuiKey_ScrollLock;
case VK_NUMLOCK: return ImGuiKey_NumLock;
case VK_SNAPSHOT: return ImGuiKey_PrintScreen;
case VK_PAUSE: return ImGuiKey_Pause;
case VK_NUMPAD0: return ImGuiKey_Keypad0;
case VK_NUMPAD1: return ImGuiKey_Keypad1;
case VK_NUMPAD2: return ImGuiKey_Keypad2;
case VK_NUMPAD3: return ImGuiKey_Keypad3;
case VK_NUMPAD4: return ImGuiKey_Keypad4;
case VK_NUMPAD5: return ImGuiKey_Keypad5;
case VK_NUMPAD6: return ImGuiKey_Keypad6;
case VK_NUMPAD7: return ImGuiKey_Keypad7;
case VK_NUMPAD8: return ImGuiKey_Keypad8;
case VK_NUMPAD9: return ImGuiKey_Keypad9;
case VK_DECIMAL: return ImGuiKey_KeypadDecimal;
case VK_DIVIDE: return ImGuiKey_KeypadDivide;
case VK_MULTIPLY: return ImGuiKey_KeypadMultiply;
case VK_SUBTRACT: return ImGuiKey_KeypadSubtract;
case VK_ADD: return ImGuiKey_KeypadAdd;
case IM_VK_KEYPAD_ENTER: return ImGuiKey_KeypadEnter;
case VK_LSHIFT: return ImGuiKey_LeftShift;
case VK_LCONTROL: return ImGuiKey_LeftCtrl;
case VK_LMENU: return ImGuiKey_LeftAlt;
case VK_LWIN: return ImGuiKey_LeftSuper;
case VK_RSHIFT: return ImGuiKey_RightShift;
case VK_RCONTROL: return ImGuiKey_RightCtrl;
case VK_RMENU: return ImGuiKey_RightAlt;
case VK_RWIN: return ImGuiKey_RightSuper;
case VK_APPS: return ImGuiKey_Menu;
case '0': return ImGuiKey_0;
case '1': return ImGuiKey_1;
case '2': return ImGuiKey_2;
case '3': return ImGuiKey_3;
case '4': return ImGuiKey_4;
case '5': return ImGuiKey_5;
case '6': return ImGuiKey_6;
case '7': return ImGuiKey_7;
case '8': return ImGuiKey_8;
case '9': return ImGuiKey_9;
case 'A': return ImGuiKey_A;
case 'B': return ImGuiKey_B;
case 'C': return ImGuiKey_C;
case 'D': return ImGuiKey_D;
case 'E': return ImGuiKey_E;
case 'F': return ImGuiKey_F;
case 'G': return ImGuiKey_G;
case 'H': return ImGuiKey_H;
case 'I': return ImGuiKey_I;
case 'J': return ImGuiKey_J;
case 'K': return ImGuiKey_K;
case 'L': return ImGuiKey_L;
case 'M': return ImGuiKey_M;
case 'N': return ImGuiKey_N;
case 'O': return ImGuiKey_O;
case 'P': return ImGuiKey_P;
case 'Q': return ImGuiKey_Q;
case 'R': return ImGuiKey_R;
case 'S': return ImGuiKey_S;
case 'T': return ImGuiKey_T;
case 'U': return ImGuiKey_U;
case 'V': return ImGuiKey_V;
case 'W': return ImGuiKey_W;
case 'X': return ImGuiKey_X;
case 'Y': return ImGuiKey_Y;
case 'Z': return ImGuiKey_Z;
case VK_F1: return ImGuiKey_F1;
case VK_F2: return ImGuiKey_F2;
case VK_F3: return ImGuiKey_F3;
case VK_F4: return ImGuiKey_F4;
case VK_F5: return ImGuiKey_F5;
case VK_F6: return ImGuiKey_F6;
case VK_F7: return ImGuiKey_F7;
case VK_F8: return ImGuiKey_F8;
case VK_F9: return ImGuiKey_F9;
case VK_F10: return ImGuiKey_F10;
case VK_F11: return ImGuiKey_F11;
case VK_F12: return ImGuiKey_F12;
default: return ImGuiKey_None;
}
}
|
// Map VK_xxx to ImGuiKey_xxx.
|
https://github.com/ddf8196/BetterRenderDragon/blob/fc4e663813e778365657a8a8aa7ad3f7c6559016/include/imgui/backends/imgui_impl_win32.cpp#L393-L503
|
fc4e663813e778365657a8a8aa7ad3f7c6559016
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
MouseCursor::updateMouseClipping
|
void MouseCursor::staticSetFocus( bool focus )
{
BW_GUARD;
if ( !focus )
{
clipCursorToWindow( false );
}
}
|
/**
* Informs the MouseCursor class about changes in the
* application focus state. This function is called even
* when the mcursor is not the active InputCursor so that
* we can do low-level house keeping chores related to the
* mouse.
*
* @param focus new application focus state.
*/
/* static */
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/ashes/mouse_cursor.cpp
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
SimpleGUI::hwnd
|
void SimpleGUI::hwnd( void * h )
{
hwnd_ = h;
}
|
/**
* This method sets the HWND for the main application window.
* SimpleGUI needs this only if the mouse cursor is to be used.
*
* @param h The HWND for the application
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/ashes/simple_gui.cpp#L370-L373
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
SimpleGUIComponent::handleDropEvent
|
bool SimpleGUIComponent::handleDropEvent( SimpleGUIComponent * dragged,
const KeyEvent & event )
{
BW_GUARD;
return this->invokeMouseEventHandler(
this->pScriptObject_.getObject(),
"handleDropEvent", event.cursorPosition(), dragged,
"SimpleGUIComponent::handleDropEvent: ",
"EventsSimpleGUIComponent handleDropEvent retval" );
}
|
/*~ function SimpleGUIComponent.handleDropEvent
* @components{ client, tools }
*
* This event handler is triggered a dragged component is dropped overa drop
* accepting component. To have this handler triggered, a component must have
* dropFocus enabled.
*
* @param component The drop target component.
* @param position mouse position, 2-tuple (x, y).
* @param dropped The dragged component being dropped.
*
* @return the return value is always ignored.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/ashes/simple_gui_component.cpp#L4220-L4229
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ChunkItemBase::addBorrower
|
void ChunkItemBase::addBorrower( Chunk* pChunk )
{
borrowers_.insert( pChunk );
#if UMBRA_ENABLE
if (pUmbraDrawItem_)
{
if (this->chunk()->getUmbraCell() == NULL &&
pChunk->getUmbraCell() != NULL)
{
pUmbraDrawItem_->updateCell( pChunk->getUmbraCell() );
}
}
#endif // UMBRA_ENABLE
}
|
// MF_SERVER
/**
* This method adds a chunk as a borrower of this item
* what this means is that the ChunkItem overlaps this chunk
* as well, which means we need to render as part of this chunk
* if it exists in a different umbra cell to our own cell
* @param pChunk the chunk that is borrowing us
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/chunk/chunk_item.cpp#L283-L297
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
UmbraChunkItem::init
|
void UmbraChunkItem::init( ChunkItem* pItem, UmbraObjectProxyPtr pObject, const Matrix& transform, Umbra::OB::Cell* pCell )
{
pItem_ = pItem;
pObject_ = pObject;
pObject_->object()->setCell( pCell );
pObject_->object()->setObjectToCellMatrix( (const Umbra::Matrix4x4&)transform );
pObject_->object()->setUserPointer( (void*)this );
pObject_->object()->setBitmask( ChunkUmbra::SCENE_OBJECT );
}
|
/**
* This method inits the UmbraChunkItem
* It uses the passed in umbra object
* @param pItem the chunk item to use
* @param pObject the umbra ubject to use
* @param transform the transform of the bounding box
* @param pCell the umbra cell to place this item in
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/chunk/umbra_chunk_item.cpp#L158-L167
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
AssetList::empty
|
bool AssetList::empty() const
{
return entries_.empty();
}
|
// ----------------------------------------------------------------------------
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/compiled_space/asset_list.cpp#L138-L141
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
BinaryFormat::BinaryFormat
|
BinaryFormat::BinaryFormat() :
pHeader_(NULL),
pSectionHeaders_(NULL)
{
memset( &mappedSections_, 0, sizeof(mappedSections_) );
}
|
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/compiled_space/binary_format.cpp#L142-L147
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ParticleSystemWriter::addFromChunkParticles
|
void ParticleSystemWriter::addFromChunkParticles(
const DataSectionPtr& pDS,
const Matrix& chunkTransform,
StringTableWriter& stringTable,
AssetListWriter& assetList )
{
BW::string resourceID = pDS->readString( "resource" );
if (resourceID.empty())
{
return;
}
if (resourceID.find( '/' ) == BW::string::npos)
{
resourceID = "particles/" + resourceID;
}
DataSectionPtr resourceDS = BWResource::openSection( resourceID );
if (!resourceDS)
{
return;
}
// ok, we're committed to loading now.
ParticleSystemTypes::ParticleSystem data;
memset( &data, 0, sizeof(data) );
data.resourceID_ = assetList.addAsset(
CompiledSpace::AssetListTypes::ASSET_TYPE_DATASECTION,
resourceID, stringTable );
data.seedTime_ = resourceDS->readFloat( "seedTime", 0.1f );
bool isReflectionVisible = pDS->readBool( "reflectionVisible",
false );
if (isReflectionVisible)
{
data.flags_ |= ParticleSystemTypes::FLAG_REFLECTION_VISIBLE;
}
// Transform
data.worldTransform_ = chunkTransform;
data.worldTransform_.preMultiply(
pDS->readMatrix34( "transform", Matrix::identity ) );
systemData_.push_back( data );
}
|
// ----------------------------------------------------------------------------
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/compiled_space/binary_writers/particle_system_writer.cpp#L71-L116
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ReplayController::handleFinal
|
void ReplayController::handleFinal()
{
handler_.onReplayControllerFinish( *this );
}
|
/**
* This method handles the 'finish' replay message, indicating end of replay.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/connection/replay_controller.cpp#L1384-L1387
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
Profiler::setNewHistory
|
bool Profiler::setNewHistory( const char * historyFileName,
const char * threadName, BW::string * msgString)
{
BW_GUARD;
this->setProfileMode( SORT_BY_NAME, false );
return csvOutputTask_->setNewHistory( historyFileName,
threadName, msgString );
}
|
/**
* Set up a new file for CSV profiling output.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/cstdmf/profiler.cpp#L2204-L2212
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
queueWrites
|
void queueWrites()
{
for (uint32 i = 1; i <= max_; ++i)
{
pWriter_->queueWriteBlob( (const char *)&i, sizeof( i ), i );
}
}
|
/**
* This method queues the writes necessary to write out the integers.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/cstdmf/unit_test/test_background_file_writer.cpp#L194-L200
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
PyModel::pySet_motors
|
int PyModel::pySet_motors( PyObject * value )
{
BW_GUARD;
// first check arguments...
if (!PySequence_Check( value ))
{
PyErr_SetString( PyExc_TypeError,
"Model.motors must be set to a sequence of Motors" );
return -1;
}
// ... thoroughly
bool bad = false;
for (int i = 0; i < PySequence_Size( value ) && !bad; i++)
{
PyObject * pTry = PySequence_GetItem( value, i );
if (!Motor::Check( pTry ))
{
PyErr_Format( PyExc_TypeError, "Element %d of sequence replacing "
" Model.motors is not a Motor", i );
bad = true;
}
else if (((Motor*)pTry)->pOwner() != NULL)
{
PyErr_Format( PyExc_ValueError, "Element %d of sequence replacing "
"Model.motors is already attached to a Model", i );
bad = true;
}
Py_DECREF( pTry );
}
if (bad) return -1;
// let old motors go
for (uint i = 0; i < motors_.size(); i++)
{
motors_[i]->detach();
Py_DECREF( motors_[i] );
}
motors_.clear();
// fit new ones
for (int i = 0; i < PySequence_Size( value ) && !bad; i++)
{
Motor * pMotor = (Motor*)PySequence_GetItem( value, i );
pMotor->attach( this );
motors_.push_back( pMotor );
// We keep the reference returned by PySequence_GetItem.
}
return 0;
}
|
/**
* Set the sequence of motors
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/duplo/pymodel.cpp#L2247-L2301
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
FixedDictDataType::getDefaultValue
|
bool FixedDictDataType::getDefaultValue( DataSink & output ) const
{
#if defined( SCRIPT_PYTHON )
const_cast<FixedDictDataType*>(this)->initCustomClassImplOnDemand();
#endif
if (pDefaultSection_)
{
return this->createFromSection( pDefaultSection_, output );
}
else if (allowNone_)
{
return output.writeNone( /* isNone */ true );
}
// TODO: Better than this.
ScriptObject pDefault = this->createDefaultInstance();
#if defined( SCRIPT_PYTHON )
if (this->hasCustomClass())
pDefault = this->createCustomClassFromInstance(
static_cast<PyFixedDictDataInstance*>(pDefault.get()) );
#endif
// Eww...
ScriptDataSink & scriptOutput = static_cast< ScriptDataSink & >( output );
return scriptOutput.write( pDefault );
}
|
/**
* Overrides the DataType method.
*
* @see DataType::getDefaultValue
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/entitydef/data_types/fixed_dict_data_type.cpp#L726-L752
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
FixedDictDataType::attach
|
ScriptObject FixedDictDataType::attach( ScriptObject pObject,
PropertyOwnerBase * pOwner, int ownerRef )
{
#if defined( SCRIPT_PYTHON )
// if it's None and that's ok, just return that
if (allowNone_ && pObject.isNone())
{
return ScriptObject::none();
}
initCustomClassImplOnDemand();
if (this->hasCustomClass())
{
// First part of isSameType() check
if (this->hasCustomIsSameType() && !this->isSameTypeCustom( pObject ))
{
ERROR_MSG( "FixedDictDataType::attach: "
"Trying to attach an invalid custom type\n" );
return ScriptObject();
}
// See if they are referencing our PyFixedDictDataInstance
ScriptObject pDict = this->getDictFromCustomClass( pObject );
// Second part of isSameType() check
if (PyFixedDictDataInstance::isSameType( pDict, *this ))
{
// Yay! isSameType() == true
PyFixedDictDataInstancePtr pInst( pDict );
if (pInst->hasOwner())
{
// Create copy
pInst = PyFixedDictDataInstancePtr(
new PyFixedDictDataInstance( this, *pInst ),
PyFixedDictDataInstancePtr::FROM_NEW_REFERENCE );
pInst->setOwner( pOwner, ownerRef );
return this->createCustomClassFromInstance( pInst.get() );
}
else
{
pInst->setOwner( pOwner, ownerRef );
return pObject;
}
}
else // not referencing PyFixedDictDataInstance
{
// Third part of isSameType() check, for custom class without
// isSameType() method and doesn't reference PyFixedDictDataInstance
if (this->hasCustomIsSameType() ||
this->createInstanceFromMappingObj( pDict ))
{
return pObject;
}
else
{
return ScriptObject();
}
}
}
PyFixedDictDataInstancePtr pInst;
// it's easy if it's the right python + entitydef type
if (PyFixedDictDataInstance::isSameType( pObject, *this ))
{
pInst = pObject;
if (pInst->hasOwner())
{
// Create copy
pInst = PyFixedDictDataInstancePtr(
new PyFixedDictDataInstance( this, *pInst ),
PyFixedDictDataInstancePtr::FROM_NEW_REFERENCE );
// note: up to caller to check that prop isn't being set back
}
}
else
{
pInst = this->createInstanceFromMappingObj( pObject );
}
if (pInst)
{
pInst->setOwner( pOwner, ownerRef );
}
return pInst;
#else
return pObject;
#endif
}
|
/**
* Overrides the DataType method.
*
* @see DataType::attach
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/entitydef/data_types/fixed_dict_data_type.cpp#L1016-L1106
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
GizmoManager::click
|
bool GizmoManager::click()
{
BW_GUARD;
if (intersectedGizmo_.hasObject())
{
intersectedGizmo_->click(lastWorldOrigin_, lastWorldRay_);
return true;
}
return false;
}
|
/**
* This method should be called when the user clicks on a gizmo
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/gizmo/gizmo_manager.cpp#L261-L271
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
OmniLight::OmniLight
|
OmniLight::OmniLight( const D3DXCOLOR& colour, const Vector3& position, float innerRadius, float outerRadius )
: position_( position ),
innerRadius_( innerRadius ),
outerRadius_( outerRadius ),
colour_( (const Colour&)colour ),
priority_( 0 )
#ifdef EDITOR_ENABLED
,multiplier_(1.f)
#endif
{
// give the worldTransformed attributes default values.
worldPosition_ = position;
worldInnerRadius_= innerRadius;
worldOuterRadius_= outerRadius;
}
|
/**
* Constructor
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/moo/omni_light.cpp#L37-L51
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
DynamicShadow::recreateForD3DExDevice
|
bool DynamicShadow::recreateForD3DExDevice() const
{
return true;
}
|
//----------------------------------------------------------------------------------------------
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/moo/dynamic_shadow.cpp#L1496-L1499
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
HTTPHeaders::Impl::parseHeaderValue
|
bool HTTPHeaders::Impl::parseHeaderValue( const char ** pByteData,
size_t length, BW::string & headerValue )
{
const char * byteData = *pByteData;
const char * cursor = byteData;
const char * headerValueChunkStart = cursor;
BW::ostringstream headerValueStream;
bool leadingLWS = true;
while (cursor < (byteData + length) &&
!HTTPUtil::isCRLF( cursor ))
{
if (HTTPUtil::isLinearWhitespace( cursor,
length - (cursor - byteData) ))
{
if (!leadingLWS)
{
// Replace any non-leading LWS with a single space, as per
// RFC2616 section 4.2.
headerValueStream.write( headerValueChunkStart,
cursor - headerValueChunkStart );
headerValueStream.put( ' ' );
}
if (!HTTPUtil::skipLinearWhitespace( &cursor,
length - (cursor - byteData) ))
{
return false;
}
headerValueChunkStart = cursor;
}
else if (*cursor == '"')
{
BW::string quotedString;
if (!HTTPUtil::parseQuotedString( &cursor,
length - (cursor - byteData ), quotedString ))
{
return false;
}
headerValueStream << quotedString;
headerValueChunkStart = cursor;
}
else if (HTTPUtil::isControlCharacter( *cursor ))
{
return false;
}
else
{
++cursor;
}
leadingLWS = false;
}
if (cursor >= (byteData + length))
{
return false;
}
headerValueStream.write( headerValueChunkStart,
cursor - headerValueChunkStart );
headerValueStream.str().swap( headerValue );
*pByteData = cursor + 2;
return true;
}
|
/**
* This method parses the header field value.
*
* Any non-leading linear whitespace will be replaced by a single space, as
* per RFC2616. Leading linear whitespace will be ignored.
*
* @param pByteData The byte pointer, moved on success to past the end of
* the terminating CRLF.
* @param length The length of the byte data.
* @pawram headerValue The output parsed header value.
*
* @return True on success, false otherwise.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/network/http_messages.cpp#L699-L767
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
operator delete
|
void operator delete( void * ptr )
{ bw_free( ptr ); }
|
/**
* The overloaded delete operator to free the memory using the same
* malloc/free methods
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/network/logger_endpoint.cpp#L161-L162
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
TCPChannel::writeFrom
|
bool TCPChannel::writeFrom( BinaryIStream & input, bool shouldCork )
{
int numToSend = input.remainingLength();
if (pSendBuffer_)
{
// We're already waiting for the socket to become available for
// writing, add it to the end.
pSendBuffer_->transfer( input, numToSend );
return true;
}
int sendResult = this->basicSend( input.retrieve( 0 ), numToSend,
shouldCork );
if ((sendResult == -1) && !isErrnoIgnorable())
{
NOTICE_MSG( "TCPChannel::writeFrom( %s ): "
"Write error, destroying; error: %s\n",
this->c_str(), lastNetworkError() );
input.finish();
this->destroy();
return false;
}
else if (sendResult == -1)
{
sendResult = 0;
}
input.retrieve( sendResult );
if (sendResult < numToSend)
{
// Got short count when sending. Add the rest to the send buffer,
// creating it and registering the socket for write events if
// necessary.
const uint8 * leftOverData =
reinterpret_cast< const uint8 * >( input.retrieve(
numToSend - sendResult ) );
if (!pSendBuffer_)
{
pSendBuffer_ = new MemoryOStream( this->maxSegmentSize() );
this->dispatcher().registerWriteFileDescriptor(
pEndpoint_->fileno(),
pSendWaiter_,
"TCPChannel" );
}
pSendBuffer_->addBlob( leftOverData, numToSend - sendResult );
}
return true;
}
|
/**
* This method writes the given input data to the channel.
*
* @param input The input data stream.
* @param shouldCork Whether we should send any corked data and this data
* now, or cork the data for sending later.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/network/tcp_channel.cpp#L707-L764
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
swap
|
void swap( UDPBundleProcessor::iterator & a, UDPBundleProcessor::iterator & b )
{
using std::swap;
swap( a.cursor_, b.cursor_ );
swap( a.isUnpacked_, b.isUnpacked_ );
swap( a.bodyEndOffset_, b.bodyEndOffset_ );
swap( a.offset_, b.offset_ );
swap( a.dataOffset_, b.dataOffset_ );
swap( a.dataLength_, b.dataLength_ );
swap( a.dataBuffer_, b.dataBuffer_ );
swap( a.nextRequestOffset_, b.nextRequestOffset_ );
swap( a.curHeader_, b.curHeader_ );
swap( a.updatedIE_, b.updatedIE_ );
}
|
/**
* This function swaps the iterators.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/network/udp_bundle_processor.cpp#L623-L637
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
SplatPSA::lateExecute
|
void SplatPSA::lateExecute( ParticleSystem &particleSystem, float dTime )
{
BW_GUARD_PROFILER( SplatPSA_execute );
const SourcePSA * pSource = static_cast< const SourcePSA * >(
&*particleSystem.pAction( PSA_SOURCE_TYPE_ID ) );
if (!pSource)
{
return;
}
const RompColliderPtr pGS = pSource->groundSpecifier();
if (!pGS)
{
return;
}
uint64 tend = timestamp() + stampsPerSecond() / 2000;
Particles::iterator it = particleSystem.begin();
Particles::iterator end = particleSystem.end();
WorldTriangle tri;
//bust out of the loop if we take more than 0.5 msec
while (it != particleSystem.end() && timestamp() < tend)
{
Particle & particle = *it;
if (!particle.isAlive())
{
continue;
}
//note - particles get moved after actions.
Vector3 velocity;
particle.getVelocity( velocity );
Vector3 newPos;
particleSystem.predictPosition( particle, dTime, newPos );
float tValue = pGS->collide( particle.position(), newPos, tri );
if (tValue >= 0.f && tValue <= 1.f)
{
#ifndef EDITOR_ENABLED
tri.bounce( velocity, 1.f );
particle.setVelocity( velocity );
if ( callback_ )
{
PyObject * pFn = PyObject_GetAttrString(
&*callback_, "onSplat" );
PyObject * pTuple = PyTuple_New( 3 );
Vector3 collidePos( particle.position() * tValue );
collidePos += (newPos * (1.f - tValue));
PyTuple_SetItem( pTuple, 0, Script::getData( collidePos ) );
Vector3 velocity;
particle.getVelocity( velocity );
PyTuple_SetItem( pTuple, 1, Script::getData( velocity ) );
PyTuple_SetItem( pTuple, 2, Script::getData(
Colour::getVector4Normalised( particle.colour() ) ) );
Script::callNextFrame( pFn, pTuple, "SplatPSA::execute" );
}
#endif
it = particleSystem.removeParticle( it );
}
else
{
++it;
}
}
}
|
/**
* This method executes the action for the given frame of time. The dTime
* parameter is the time elapsed since the last call.
*
* @param particleSystem The particle system on which to operate.
* @param dTime Elapsed time in seconds.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/particle/actions/splat_psa.cpp#L50-L122
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
PyDataSection::s_length
|
Py_ssize_t PyDataSection::s_length( PyObject * self )
{
return ((PyDataSection *) self)->length();
}
|
/**
* This function returns the number of entities in the system.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/pyscript/py_data_section.cpp#L50-L53
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
PackedSection::asUInt64
|
uint64 PackedSection::asUInt64( uint64 defaultVal )
{
// TODO: store 64-bit values as TYPE_INT? Murph suggested using 9 bytes for
// uint64s as a special case.
DataSectionPtr pDS = getXMLSection();
pDS->setString( static_cast< DataSection * >( this )->asString() );
return pDS->asUInt64( defaultVal );
}
|
/*
* Override from DataSection.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/resmgr/packed_section.cpp#L856-L863
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ZipFileSystem::LocalFile::diskName
|
BW::string ZipFileSystem::LocalFile::diskName()
{
return isFolder()? filename_ + "/": filename_;
}
|
/**
* This method return the name of the file that should be written on the disk
*
* @return the name of the file
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/resmgr/zip_file_system.cpp#L1546-L1549
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
GlyphReferenceHolder::report
|
void GlyphReferenceHolder::report() const
{
BW_GUARD;
GlyphReferenceCountMap::const_iterator it = refCounts_.begin();
GlyphReferenceCountMap::const_iterator en = refCounts_.end();
while (it != en)
{
DEBUG_MSG( "%c - %d\n", it->first, it->second );
++it;
}
}
|
/**
* This method lists all the reference counts as debug messages.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/romp/glyph_reference_holder.cpp#L84-L94
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
XConsole::print
|
void XConsole::print( const char* string )
{
BW_GUARD;
wchar_t converted[2] = {0, 0};
size_t numBytes = bw_utf8tow_incremental( string, converted );
while (numBytes > 0)
{
MF_ASSERT( !converted[1] );
this->print( converted );
string += numBytes;
numBytes = bw_utf8tow_incremental( string, converted );
}
}
|
/**
* This method prints the input string to the console at the current cursor
* position.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/romp/xconsole.cpp#L246-L258
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ListMultiProvider::~ListMultiProvider
|
ListMultiProvider::~ListMultiProvider()
{
BW_GUARD;
}
|
/**
* Destructor.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/lib/ual/list_multi_provider.cpp#L76-L79
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
onReplayDataFileReaderHeader
|
virtual bool onReplayDataFileReaderHeader( ReplayDataFileReader & reader,
const ReplayHeader & header, BW::string & errorString )
{
header_ = header;
return true;
}
|
/* Override from IReplayDataFileReaderListener. */
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/server/baseapp/unit_test/test_recording.cpp#L400-L405
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ClientCaller::ClientCaller
|
ClientCaller::ClientCaller( Entity & entity,
const MethodDescription & methodDescription,
bool isForOwn,
bool isForOthers,
RecordingOption recordingOption,
const BW::string & destEntityTypeName,
EntityID destID,
PyTypeObject * pType /* = &ClientCaller::s_type_ */ ) :
PyObjectPlus( pType ),
entity_( entity ),
methodDescription_( methodDescription ),
isForOwn_( isForOwn ),
isForOthers_( isForOthers ),
isExposedForReplay_( false ),
destID_( destID ),
destEntityTypeName_( destEntityTypeName )
{
Py_INCREF( &entity_ );
switch (recordingOption)
{
case RECORDING_OPTION_METHOD_DEFAULT:
if (isForOwn && !isForOthers)
{
isExposedForReplay_ =
(methodDescription.replayExposureLevel() >=
MethodDescription::REPLAY_EXPOSURE_LEVEL_ALL_CLIENTS);
}
else if (isForOthers)
{
isExposedForReplay_ =
(methodDescription.replayExposureLevel() >=
MethodDescription::REPLAY_EXPOSURE_LEVEL_OTHER_CLIENTS);
}
break;
case RECORDING_OPTION_RECORD_ONLY:
isForOwn_ = false;
isForOthers_ = false;
// Fall through
case RECORDING_OPTION_RECORD:
isExposedForReplay_ = true;
break;
case RECORDING_OPTION_DO_NOT_RECORD:
default:
// Leave isExposedForReplay_ to false
break;
}
}
|
/**
* Constructor.
*
* @param methodDescription The method description.
* @param isForOwn Whether this will be sent to the entity's own
* client.
* @param isForOthers Whether this will be sent to other clients that
* have this entity in their AoI.
* @param recordingOption See RecordingOption enum.
* @param destEntityTypeName The name of the destination entity's type.
* @param destID The destination entity's ID.
* @param pType The type object to initialise this Python
* object to.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/server/cellapp/py_client.cpp#L99-L148
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
Witness::deleteFromClient
|
void Witness::deleteFromClient( Mercury::Bundle & bundle,
EntityCache * pCache )
{
pCache->clearRefresh();
EntityID id = pCache->pEntity()->id();
if (!pCache->isEnterPending())
{
pCache->addLeaveAoIMessage( bundle, id );
}
this->onLeaveAoI( pCache, id );
// Reset client related state
pCache->onEntityRemovedFromClient();
}
|
/**
* This method informs the client that an entity has left its AoI.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/server/cellapp/witness.cpp#L1922-L1938
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
CellApp::onSignalled
|
void CellApp::onSignalled( int sigNum )
{
if (sigNum == SIGQUIT)
{
// Just print out some information, and pass it up to EntityApp to dump
// core.
ERROR_MSG( "CellApp::onSignalled: "
"load = %f. emergencyThrottle = %f. "
"Time since tick = %f seconds\n",
this->getLoad(), this->emergencyThrottle(),
stampsToSeconds( timestamp() - this->lastGameTickTime() ) );
}
this->EntityApp::onSignalled( sigNum );
}
|
/**
* Signal handler.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/server/cellapp/cellapp.cpp#L3606-L3621
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
MainApp::addBotsWithName
|
void MainApp::addBotsWithName( PyObjectPtr pCredentialSequence )
{
if (!pCredentialSequence || pCredentialSequence == Py_None)
{
PyErr_SetString( PyExc_TypeError,
"Bots::addBotsWithName: Empty login info. "
"Expecting a list of tuples containing username and password." );
return;
}
if (!PySequence_Check( pCredentialSequence.get() ))
{
PyErr_SetString( PyExc_TypeError, "Bots::addBotsWithName: "
"Expecting a list of tuples containing username and password." );
return;
}
Py_ssize_t numCredentials = PySequence_Size(
pCredentialSequence.get() );
for (Py_ssize_t i = 0; i < numCredentials; ++i)
{
PyObject * pCredentials = PySequence_GetItem(
pCredentialSequence.get(), i );
if (!PyTuple_Check( pCredentials ) || PyTuple_Size( pCredentials ) != 2)
{
PyErr_Format( PyExc_TypeError,
"Bots::addBotsWithName: Argument list item %" PRIzd " must "
"be tuple of two strings.", i );
Py_XDECREF( pCredentials );
return;
}
PyObject * pClientName = PySequence_GetItem( pCredentials, 0 );
PyObject * pClientPassword = PySequence_GetItem( pCredentials, 1 );
Py_DECREF( pCredentials );
if (!PyString_Check( pClientName ) ||
!PyString_Check( pClientPassword ))
{
PyErr_Format( PyExc_TypeError, "Bots::addBotsWithName: "
"Invalid credentials for element %" PRIzd ". Expecting a tuple "
"containing a username and password.", i );
Py_XDECREF( pClientName );
Py_XDECREF( pClientPassword );
return;
}
this->addBotWithName( BW::string( PyString_AsString( pClientName ) ),
BW::string( PyString_AsString( pClientPassword ) ) );
Py_DECREF( pClientName );
Py_DECREF( pClientPassword );
}
}
|
/**
* This method adds a set of new bot client applications to the Bots process
* using a pregenerated list of usernames and passwords.
*
* @param pCredentialSequence The Python list containing tuples of
* username/password pairs to be used in creating
* the ClientApps.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/server/tools/bots/main_app.cpp#L441-L498
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
~BotAdder
|
virtual ~BotAdder()
{
timer_.cancel();
}
|
/**
* Destructor.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/server/tools/bots/main_app.cpp#L1208-L1211
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
InputOptions::setMipmapFilter
|
void InputOptions::setMipmapFilter(MipmapFilter filter)
{
m.mipmapFilter = filter;
}
|
/// Set mipmap filter.
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/third_party/nvtt/src/nvtt/InputOptions.cpp#L278-L281
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
setNormalMap
|
void setNormalMap(nvtt::InputOptions & inputOptions)
{
inputOptions.setNormalMap(true);
inputOptions.setConvertToNormalMap(false);
inputOptions.setGamma(1.0f, 1.0f);
inputOptions.setNormalizeMipmaps(true);
}
|
// Set options for normal maps.
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/third_party/nvtt/src/nvtt/tools/benchmark.cpp#L59-L65
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
VisualProcessor::VisualProcessor
|
VisualProcessor::VisualProcessor( const BW::string & params ) :
Converter( params )
{
BW_GUARD;
}
|
/* construct a converter with parameters. */
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/asset_pipeline/converters/visual_processor/visual_processor.cpp#L46-L50
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
Undo::updateActions
|
void Undo::updateActions( void )
{
if ( undoAction_ )
undoAction_->Enabled = undoEnabled_;
if ( redoAction_ )
redoAction_->Enabled = redoEnabled_;
}
|
//---------------------------------------------------------------------------
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/common/undo.cpp#L477-L484
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
CommonUtility::removePath
|
AnsiString __fastcall CommonUtility::removePath( AnsiString filename )
{
AnsiString name;
int start, backSlashPos, forewardSlashPos, end;
backSlashPos = filename.LastDelimiter( "\\" ) + 1;
forewardSlashPos = filename.LastDelimiter( "/" ) + 1;
if ( backSlashPos > forewardSlashPos )
start = backSlashPos;
else
start = forewardSlashPos;
end = filename.Length() + 1;
if ( start < end )
{
for ( int i = start; i < end; i++ )
name += filename[i];
}
else
name = filename;
return name;
}
|
//---------------------------------------------------------------------------
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/common/common_utility.cpp#L199-L223
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
LightingPlan::VirtualLight::drawDirectional
|
void LightingPlan::VirtualLight::drawDirectional()
{
}
|
/**
* This method draws a directional light, as a cylinder
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/common/lighting_plan.cpp#L149-L151
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
ExpandSpaceDlg::validationChange
|
void ExpandSpaceDlg::validationChange( bool validationResult )
{
if ( validationResult )
{
btnExpand_.EnableWindow( TRUE );
}
else
{
btnExpand_.EnableWindow( FALSE );
}
}
|
/*virtual */
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/worldeditor/gui/dialogs/expand_space_dlg.cpp
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
PageTerrainImport::UpdateState
|
void PageTerrainImport::UpdateState()
{
BW_GUARD;
if (!pageReady_)
InitPage();
if (!HeightModule::hasStarted())
return;
HeightModule *hm = HeightModule::currentInstance();
BOOL importing = hm->hasImportData();
BOOL exporting = !importing;
// Inform the height module about the mode and strengths:
if (importing)
hm->mode(HeightModule::IMPORT_TERRAIN);
else if (exporting)
hm->mode(HeightModule::EXPORT_TERRAIN);
// Update subclassed controls:
exportBtn_ .EnableWindow(exporting);
heightStrengthEdit_ .EnableWindow(importing);
heightStrengthSlider_.EnableWindow(importing);
modeCB_ .EnableWindow(importing);
placeBtn_ .EnableWindow(importing);
cancelBtn_ .EnableWindow(importing);
}
|
/**
* This is called to update the state of the controls.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/worldeditor/gui/pages/page_terrain_import.cpp#L909-L937
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
BigWorld-Engine-14.4.1
|
github_2023
|
v2v3v4
|
cpp
|
SceneBrowserDlg::OnUpdateControls
|
LRESULT SceneBrowserDlg::OnUpdateControls( WPARAM wParam, LPARAM lParam )
{
BW_GUARD;
static DogWatch dw( "SceneBrowserTick" );
ScopedDogWatch sdw( dw );
uint64 startTick = timestamp();
bool needsUpdateStatusBar = false;
bool forceListTick = false;
if (ItemInfoDB::instance().needsTick())
{
// The user must have changed something, try to spend some time updating
// the item db, and make sure the list updated on the next frame.
ItemInfoDB::instance().tick( MAX_DB_MILLIS * MAX_DB_MILLIS_MULTIPLIER );
forceListTick = true;
}
bool showWorkingAnim = ItemInfoDB::instance().hasChanged();
uint64 timeSinceLastUpdate =
(timestamp() - lastUpdate_) * 1000 / stampsPerSecond();
if (forceListTick || list_.needsTick() || timeSinceLastUpdate > CHECK_UPDATE_LIST_MILLIS)
{
// Time to update the list.
if (list_.tick( forceListTick ))
{
needsUpdateStatusBar = true;
showWorkingAnim = true;
}
lastUpdate_ = timestamp();
}
if (showWorkingAnim)
workingAnim_.show();
else
workingAnim_.hide();
workingAnim_.update();
if (list_.hasSelectionChanged())
{
static DogWatch dw( "SetAppSelection" );
ScopedDogWatch sdw( dw );
// Selection changed by the list after user interaction
if (SceneBrowser::instance().callbackSelChange())
{
CWaitCursor wait;
(*SceneBrowser::instance().callbackSelChange())(
list_.selection() );
}
if (SceneBrowser::instance().callbackCurrentSel())
{
const BW::vector<ChunkItemPtr> & cbSelection =
(*SceneBrowser::instance().callbackCurrentSel())();
lastSelection_ = cbSelection;
}
needsUpdateStatusBar = true;
list_.clearSelectionChanged();
}
else if (SceneBrowser::instance().callbackCurrentSel())
{
static DogWatch dw( "GetAppSelection" );
ScopedDogWatch sdw( dw );
// Selection changed from the outside
const BW::vector<ChunkItemPtr> & cbSelection =
(*SceneBrowser::instance().callbackCurrentSel())();
if (lastSelection_ != cbSelection)
{
lastSelection_ = cbSelection;
// Make sure the list's and DB's items are to date.
ItemInfoDB::instance().tick();
list_.tick();
lastUpdate_ = timestamp();
list_.selection( lastSelection_ );
needsUpdateStatusBar = true;
}
}
if (needsUpdateStatusBar)
{
static DogWatch dw( "UpdateStatusBar" );
ScopedDogWatch sdw( dw );
updateStatusBar();
}
// Update the database if there's still remaining tick time. We do this to
// reduce spikes in the frame rate.
int ellapsedTickMillis =
int( (timestamp() - startTick) * 1000 / stampsPerSecond() );
int multiplier = std::min(
1 + ItemInfoDB::instance().numPending() / MAX_DB_MILLIS_STEP,
MAX_DB_MILLIS_MULTIPLIER );
int maxMillis = MAX_DB_MILLIS * multiplier;
int dbTickMaxMillis = std::max( 0, maxMillis - ellapsedTickMillis );
ItemInfoDB::instance().tick( dbTickMaxMillis );
return 0;
}
|
/**
* This message is sent from the app once each frame.
*
* @param wParam unused.
* @param lParam unused.
* @return Ignored.
*/
|
https://github.com/v2v3v4/BigWorld-Engine-14.4.1/blob/4389085c8ce35cff887a4cc18fc47d1133d89ffb/programming/bigworld/tools/worldeditor/gui/scene_browser/scene_browser_dlg.cpp#L472-L582
|
4389085c8ce35cff887a4cc18fc47d1133d89ffb
|
airwin2rack
|
github_2023
|
baconpaul
|
cpp
|
pinParameter
|
static float pinParameter(float data)
{
if (data < 0.0f) return 0.0f;
if (data > 1.0f) return 1.0f;
return data;
}
|
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
|
https://github.com/baconpaul/airwin2rack/blob/ecda72c1ec5211885bf4f83e61abae80e0457cd3/src/autogen_airwin/Crystal.cpp#L48-L53
|
ecda72c1ec5211885bf4f83e61abae80e0457cd3
|
airwin2rack
|
github_2023
|
baconpaul
|
cpp
|
LRConvolve::getEffectName
|
bool LRConvolve::getEffectName(char* name) {
vst_strncpy(name, "LRConvolve", kVstMaxProductStrLen); return true;
}
|
// 1 = yes, -1 = no, 0 = don't know
|
https://github.com/baconpaul/airwin2rack/blob/ecda72c1ec5211885bf4f83e61abae80e0457cd3/src/autogen_airwin/LRConvolve.cpp#L67-L69
|
ecda72c1ec5211885bf4f83e61abae80e0457cd3
|
airwin2rack
|
github_2023
|
baconpaul
|
cpp
|
pinParameter
|
static float pinParameter(float data)
{
if (data < 0.0f) return 0.0f;
if (data > 1.0f) return 1.0f;
return data;
}
|
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
|
https://github.com/baconpaul/airwin2rack/blob/ecda72c1ec5211885bf4f83e61abae80e0457cd3/src/autogen_airwin/TapeBias.cpp#L45-L50
|
ecda72c1ec5211885bf4f83e61abae80e0457cd3
|
airwin2rack
|
github_2023
|
baconpaul
|
cpp
|
pinParameter
|
static float pinParameter(float data)
{
if (data < 0.0f) return 0.0f;
if (data > 1.0f) return 1.0f;
return data;
}
|
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
|
https://github.com/baconpaul/airwin2rack/blob/ecda72c1ec5211885bf4f83e61abae80e0457cd3/src/autogen_airwin/PurestWarm.cpp#L42-L47
|
ecda72c1ec5211885bf4f83e61abae80e0457cd3
|
airwin2rack
|
github_2023
|
baconpaul
|
cpp
|
BrightAmbience::getEffectName
|
bool BrightAmbience::getEffectName(char* name) {
vst_strncpy(name, "BrightAmbience", kVstMaxProductStrLen); return true;
}
|
// 1 = yes, -1 = no, 0 = don't know
|
https://github.com/baconpaul/airwin2rack/blob/ecda72c1ec5211885bf4f83e61abae80e0457cd3/src/autogen_airwin/BrightAmbience.cpp#L101-L103
|
ecda72c1ec5211885bf4f83e61abae80e0457cd3
|
airwin2rack
|
github_2023
|
baconpaul
|
cpp
|
BezEQ::getEffectName
|
bool BezEQ::getEffectName(char* name) {
vst_strncpy(name, "BezEQ", kVstMaxProductStrLen); return true;
}
|
// 1 = yes, -1 = no, 0 = don't know
|
https://github.com/baconpaul/airwin2rack/blob/ecda72c1ec5211885bf4f83e61abae80e0457cd3/src/autogen_airwin/BezEQ.cpp#L115-L117
|
ecda72c1ec5211885bf4f83e61abae80e0457cd3
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
kdtreequerybox
|
ae_int_t kdtreequerybox(const kdtree &kdt,
const real_1d_array &boxmin,
const real_1d_array &boxmax,
const xparams _xparams) {
jmp_buf _break_jump;
alglib_impl::ae_state _alglib_env_state;
alglib_impl::ae_state_init(&_alglib_env_state);
if (setjmp(_break_jump)) {
#if !defined(AE_NO_EXCEPTIONS)
_ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
#else
_ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
return 0;
#endif
}
ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
if (_xparams.flags != 0x0)
ae_state_set_flags(&_alglib_env_state, _xparams.flags);
alglib_impl::ae_int_t result = alglib_impl::kdtreequerybox(const_cast<alglib_impl::kdtree *>(kdt.c_ptr()),
const_cast<alglib_impl::ae_vector *>(boxmin.c_ptr()),
const_cast<alglib_impl::ae_vector *>(boxmax.c_ptr()),
&_alglib_env_state);
alglib_impl::ae_state_clear(&_alglib_env_state);
return *(reinterpret_cast<ae_int_t *>(&result));
}
|
/*************************************************************************
Box query: all points within user-specified box.
IMPORTANT: this function can not be used in multithreaded code because it
uses internal temporary buffer of kd-tree object, which can not
be shared between multiple threads. If you want to perform
parallel requests, use function which uses external request
buffer: KDTreeTsQueryBox() ("Ts" stands for "thread-safe").
INPUT PARAMETERS
KDT - KD-tree
BoxMin - lower bounds, array[0..NX-1].
BoxMax - upper bounds, array[0..NX-1].
RESULT
number of actual neighbors found (in [0,N]).
This subroutine performs query and stores its result in the internal
structures of the KD-tree. You can use following subroutines to obtain
these results:
* KDTreeQueryResultsX() to get X-values
* KDTreeQueryResultsXY() to get X- and Y-values
* KDTreeQueryResultsTags() to get tag values
* KDTreeQueryResultsDistances() returns zeros for this request
NOTE: this particular query returns unordered results, because there is no
meaningful way of ordering points. Furthermore, no 'distance' is
associated with points - it is either INSIDE or OUTSIDE (so request
for distances will return zeros).
-- ALGLIB --
Copyright 14.05.2016 by Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/alglibmisc.cpp#L1915-L1939
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
mlpissoftmax
|
ae_bool mlpissoftmax(multilayerperceptron *network, ae_state *_state) {
ae_bool result;
result = network->structinfo.ptr.p_int[6] == 1;
return result;
}
|
/*************************************************************************
Tells whether network is SOFTMAX-normalized (i.e. classifier) or not.
-- ALGLIB --
Copyright 04.11.2007 by Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/dataanalysis.cpp#L22283-L22288
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
mlpeserialize
|
void mlpeserialize(ae_serializer *s,
mlpensemble *ensemble,
ae_state *_state) {
ae_serializer_serialize_int(s, getmlpeserializationcode(_state), _state);
ae_serializer_serialize_int(s, mlpe_mlpefirstversion, _state);
ae_serializer_serialize_int(s, ensemble->ensemblesize, _state);
serializerealarray(s, &ensemble->weights, -1, _state);
serializerealarray(s, &ensemble->columnmeans, -1, _state);
serializerealarray(s, &ensemble->columnsigmas, -1, _state);
mlpserialize(s, &ensemble->network, _state);
}
|
/*************************************************************************
Serializer: serialization
-- ALGLIB --
Copyright 14.03.2011 by Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/dataanalysis.cpp#L36987-L36998
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
lsfitcreatef
|
void lsfitcreatef(const real_2d_array &x,
const real_1d_array &y,
const real_1d_array &c,
const ae_int_t n,
const ae_int_t m,
const ae_int_t k,
const double diffstep,
lsfitstate &state,
const xparams _xparams) {
jmp_buf _break_jump;
alglib_impl::ae_state _alglib_env_state;
alglib_impl::ae_state_init(&_alglib_env_state);
if (setjmp(_break_jump)) {
#if !defined(AE_NO_EXCEPTIONS)
_ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
#else
_ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
return;
#endif
}
ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
if (_xparams.flags != 0x0)
ae_state_set_flags(&_alglib_env_state, _xparams.flags);
alglib_impl::lsfitcreatef(const_cast<alglib_impl::ae_matrix *>(x.c_ptr()),
const_cast<alglib_impl::ae_vector *>(y.c_ptr()),
const_cast<alglib_impl::ae_vector *>(c.c_ptr()),
n,
m,
k,
diffstep,
const_cast<alglib_impl::lsfitstate *>(state.c_ptr()),
&_alglib_env_state);
alglib_impl::ae_state_clear(&_alglib_env_state);
return;
}
|
/*************************************************************************
Nonlinear least squares fitting using function values only.
Combination of numerical differentiation and secant updates is used to
obtain function Jacobian.
Nonlinear task min(F(c)) is solved, where
F(c) = (f(c,x[0])-y[0])^2 + ... + (f(c,x[n-1])-y[n-1])^2,
* N is a number of points,
* M is a dimension of a space points belong to,
* K is a dimension of a space of parameters being fitted,
* w is an N-dimensional vector of weight coefficients,
* x is a set of N points, each of them is an M-dimensional vector,
* c is a K-dimensional vector of parameters being fitted
This subroutine uses only f(c,x[i]).
INPUT PARAMETERS:
X - array[0..N-1,0..M-1], points (one row = one point)
Y - array[0..N-1], function values.
C - array[0..K-1], initial approximation to the solution,
N - number of points, N>1
M - dimension of space
K - number of parameters being fitted
DiffStep- numerical differentiation step;
should not be very small or large;
large = loss of accuracy
small = growth of round-off errors
OUTPUT PARAMETERS:
State - structure which stores algorithm state
-- ALGLIB --
Copyright 18.10.2008 by Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/interpolation.cpp#L12177-L12211
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
lsfit_internalchebyshevfit
|
static void lsfit_internalchebyshevfit(/* Real */ ae_vector *x,
/* Real */ ae_vector *y,
/* Real */ ae_vector *w,
ae_int_t n,
/* Real */ ae_vector *xc,
/* Real */ ae_vector *yc,
/* Integer */ ae_vector *dc,
ae_int_t k,
ae_int_t m,
ae_int_t *info,
/* Real */ ae_vector *c,
lsfitreport *rep,
ae_state *_state) {
ae_frame _frame_block;
ae_vector _xc;
ae_vector _yc;
ae_vector y2;
ae_vector w2;
ae_vector tmp;
ae_vector tmp2;
ae_vector tmpdiff;
ae_vector bx;
ae_vector by;
ae_vector bw;
ae_matrix fmatrix;
ae_matrix cmatrix;
ae_int_t i;
ae_int_t j;
double mx;
double decay;
ae_frame_make(_state, &_frame_block);
memset(&_xc, 0, sizeof(_xc));
memset(&_yc, 0, sizeof(_yc));
memset(&y2, 0, sizeof(y2));
memset(&w2, 0, sizeof(w2));
memset(&tmp, 0, sizeof(tmp));
memset(&tmp2, 0, sizeof(tmp2));
memset(&tmpdiff, 0, sizeof(tmpdiff));
memset(&bx, 0, sizeof(bx));
memset(&by, 0, sizeof(by));
memset(&bw, 0, sizeof(bw));
memset(&fmatrix, 0, sizeof(fmatrix));
memset(&cmatrix, 0, sizeof(cmatrix));
ae_vector_init_copy(&_xc, xc, _state, ae_true);
xc = &_xc;
ae_vector_init_copy(&_yc, yc, _state, ae_true);
yc = &_yc;
*info = 0;
ae_vector_clear(c);
_lsfitreport_clear(rep);
ae_vector_init(&y2, 0, DT_REAL, _state, ae_true);
ae_vector_init(&w2, 0, DT_REAL, _state, ae_true);
ae_vector_init(&tmp, 0, DT_REAL, _state, ae_true);
ae_vector_init(&tmp2, 0, DT_REAL, _state, ae_true);
ae_vector_init(&tmpdiff, 0, DT_REAL, _state, ae_true);
ae_vector_init(&bx, 0, DT_REAL, _state, ae_true);
ae_vector_init(&by, 0, DT_REAL, _state, ae_true);
ae_vector_init(&bw, 0, DT_REAL, _state, ae_true);
ae_matrix_init(&fmatrix, 0, 0, DT_REAL, _state, ae_true);
ae_matrix_init(&cmatrix, 0, 0, DT_REAL, _state, ae_true);
lsfit_clearreport(rep, _state);
/*
* weight decay for correct handling of task which becomes
* degenerate after constraints are applied
*/
decay = 10000 * ae_machineepsilon;
/*
* allocate space, initialize/fill:
* * FMatrix- values of basis functions at X[]
* * CMatrix- values (derivatives) of basis functions at XC[]
* * fill constraints matrix
* * fill first N rows of design matrix with values
* * fill next M rows of design matrix with regularizing term
* * append M zeros to Y
* * append M elements, mean(abs(W)) each, to W
*/
ae_vector_set_length(&y2, n + m, _state);
ae_vector_set_length(&w2, n + m, _state);
ae_vector_set_length(&tmp, m, _state);
ae_vector_set_length(&tmpdiff, m, _state);
ae_matrix_set_length(&fmatrix, n + m, m, _state);
if (k > 0) {
ae_matrix_set_length(&cmatrix, k, m + 1, _state);
}
/*
* Fill design matrix, Y2, W2:
* * first N rows with basis functions for original points
* * next M rows with decay terms
*/
for (i = 0; i <= n - 1; i++) {
/*
* prepare Ith row
* use Tmp for calculations to avoid multidimensional arrays overhead
*/
for (j = 0; j <= m - 1; j++) {
if (j == 0) {
tmp.ptr.p_double[j] = (double) (1);
} else {
if (j == 1) {
tmp.ptr.p_double[j] = x->ptr.p_double[i];
} else {
tmp.ptr.p_double[j] = 2 * x->ptr.p_double[i] * tmp.ptr.p_double[j - 1] - tmp.ptr.p_double[j - 2];
}
}
}
ae_v_move(&fmatrix.ptr.pp_double[i][0], 1, &tmp.ptr.p_double[0], 1, ae_v_len(0, m - 1));
}
for (i = 0; i <= m - 1; i++) {
for (j = 0; j <= m - 1; j++) {
if (i == j) {
fmatrix.ptr.pp_double[n + i][j] = decay;
} else {
fmatrix.ptr.pp_double[n + i][j] = (double) (0);
}
}
}
ae_v_move(&y2.ptr.p_double[0], 1, &y->ptr.p_double[0], 1, ae_v_len(0, n - 1));
ae_v_move(&w2.ptr.p_double[0], 1, &w->ptr.p_double[0], 1, ae_v_len(0, n - 1));
mx = (double) (0);
for (i = 0; i <= n - 1; i++) {
mx = mx + ae_fabs(w->ptr.p_double[i], _state);
}
mx = mx / n;
for (i = 0; i <= m - 1; i++) {
y2.ptr.p_double[n + i] = (double) (0);
w2.ptr.p_double[n + i] = mx;
}
/*
* fill constraints matrix
*/
for (i = 0; i <= k - 1; i++) {
/*
* prepare Ith row
* use Tmp for basis function values,
* TmpDiff for basos function derivatives
*/
for (j = 0; j <= m - 1; j++) {
if (j == 0) {
tmp.ptr.p_double[j] = (double) (1);
tmpdiff.ptr.p_double[j] = (double) (0);
} else {
if (j == 1) {
tmp.ptr.p_double[j] = xc->ptr.p_double[i];
tmpdiff.ptr.p_double[j] = (double) (1);
} else {
tmp.ptr.p_double[j] = 2 * xc->ptr.p_double[i] * tmp.ptr.p_double[j - 1] - tmp.ptr.p_double[j - 2];
tmpdiff.ptr.p_double[j] = 2 * (tmp.ptr.p_double[j - 1] + xc->ptr.p_double[i] * tmpdiff.ptr.p_double[j - 1])
- tmpdiff.ptr.p_double[j - 2];
}
}
}
if (dc->ptr.p_int[i] == 0) {
ae_v_move(&cmatrix.ptr.pp_double[i][0], 1, &tmp.ptr.p_double[0], 1, ae_v_len(0, m - 1));
}
if (dc->ptr.p_int[i] == 1) {
ae_v_move(&cmatrix.ptr.pp_double[i][0], 1, &tmpdiff.ptr.p_double[0], 1, ae_v_len(0, m - 1));
}
cmatrix.ptr.pp_double[i][m] = yc->ptr.p_double[i];
}
/*
* Solve constrained task
*/
if (k > 0) {
/*
* solve using regularization
*/
lsfitlinearwc(&y2, &w2, &fmatrix, &cmatrix, n + m, m, k, info, c, rep, _state);
} else {
/*
* no constraints, no regularization needed
*/
lsfitlinearwc(y, w, &fmatrix, &cmatrix, n, m, 0, info, c, rep, _state);
}
if (*info < 0) {
ae_frame_leave(_state);
return;
}
ae_frame_leave(_state);
}
|
/*************************************************************************
This is internal function for Chebyshev fitting.
It assumes that input data are normalized:
* X/XC belong to [-1,+1],
* mean(Y)=0, stddev(Y)=1.
It does not checks inputs for errors.
This function is used to fit general (shifted) Chebyshev models, power
basis models or barycentric models.
INPUT PARAMETERS:
X - points, array[0..N-1].
Y - function values, array[0..N-1].
W - weights, array[0..N-1]
N - number of points, N>0.
XC - points where polynomial values/derivatives are constrained,
array[0..K-1].
YC - values of constraints, array[0..K-1]
DC - array[0..K-1], types of constraints:
* DC[i]=0 means that P(XC[i])=YC[i]
* DC[i]=1 means that P'(XC[i])=YC[i]
K - number of constraints, 0<=K<M.
K=0 means no constraints (XC/YC/DC are not used in such cases)
M - number of basis functions (= polynomial_degree + 1), M>=1
OUTPUT PARAMETERS:
Info- same format as in LSFitLinearW() subroutine:
* Info>0 task is solved
* Info<=0 an error occured:
-4 means inconvergence of internal SVD
-3 means inconsistent constraints
C - interpolant in Chebyshev form; [-1,+1] is used as base interval
Rep - report, same format as in LSFitLinearW() subroutine.
Following fields are set:
* RMSError rms error on the (X,Y).
* AvgError average error on the (X,Y).
* AvgRelError average relative error on the non-zero Y
* MaxError maximum error
NON-WEIGHTED ERRORS ARE CALCULATED
IMPORTANT:
this subroitine doesn't calculate task's condition number for K<>0.
-- ALGLIB PROJECT --
Copyright 10.12.2009 by Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/interpolation.cpp#L38128-L38317
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
cmatrixqrunpackr
|
void cmatrixqrunpackr(/* Complex */ ae_matrix *a,
ae_int_t m,
ae_int_t n,
/* Complex */ ae_matrix *r,
ae_state *_state) {
ae_int_t i;
ae_int_t k;
ae_matrix_clear(r);
if (m <= 0 || n <= 0) {
return;
}
k = ae_minint(m, n, _state);
ae_matrix_set_length(r, m, n, _state);
for (i = 0; i <= n - 1; i++) {
r->ptr.pp_complex[0][i] = ae_complex_from_i(0);
}
for (i = 1; i <= m - 1; i++) {
ae_v_cmove(&r->ptr.pp_complex[i][0], 1, &r->ptr.pp_complex[0][0], 1, "N", ae_v_len(0, n - 1));
}
for (i = 0; i <= k - 1; i++) {
ae_v_cmove(&r->ptr.pp_complex[i][i], 1, &a->ptr.pp_complex[i][i], 1, "N", ae_v_len(i, n - 1));
}
}
|
/*************************************************************************
Unpacking of matrix R from the QR decomposition of a matrix A
Input parameters:
A - matrices Q and R in compact form.
Output of CMatrixQR subroutine.
M - number of rows in given matrix A. M>=0.
N - number of columns in given matrix A. N>=0.
Output parameters:
R - matrix R, array[0..M-1, 0..N-1].
-- ALGLIB routine --
17.02.2010
Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/linalg.cpp#L35642-L35666
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
minnsrestartfrom
|
void minnsrestartfrom(const minnsstate &state, const real_1d_array &x, const xparams _xparams)
{
jmp_buf _break_jump;
alglib_impl::ae_state _alglib_env_state;
alglib_impl::ae_state_init(&_alglib_env_state);
if( setjmp(_break_jump) )
{
#if !defined(AE_NO_EXCEPTIONS)
_ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
#else
_ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
return;
#endif
}
ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
if( _xparams.flags!=0x0 )
ae_state_set_flags(&_alglib_env_state, _xparams.flags);
alglib_impl::minnsrestartfrom(const_cast<alglib_impl::minnsstate*>(state.c_ptr()), const_cast<alglib_impl::ae_vector*>(x.c_ptr()), &_alglib_env_state);
alglib_impl::ae_state_clear(&_alglib_env_state);
return;
}
|
/*************************************************************************
This subroutine restarts algorithm from new point.
All optimization parameters (including constraints) are left unchanged.
This function allows to solve multiple optimization problems (which
must have same number of dimensions) without object reallocation penalty.
INPUT PARAMETERS:
State - structure previously allocated with minnscreate() call.
X - new starting point.
-- ALGLIB --
Copyright 18.05.2015 by Bochkanov Sergey
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/optimization.cpp#L13529-L13549
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
GCNO
|
github_2023
|
Xrvitd
|
cpp
|
invfdistribution
|
double invfdistribution(const ae_int_t a, const ae_int_t b, const double y, const xparams _xparams) {
jmp_buf _break_jump;
alglib_impl::ae_state _alglib_env_state;
alglib_impl::ae_state_init(&_alglib_env_state);
if (setjmp(_break_jump)) {
#if !defined(AE_NO_EXCEPTIONS)
_ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
#else
_ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
return 0;
#endif
}
ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
if (_xparams.flags != 0x0)
ae_state_set_flags(&_alglib_env_state, _xparams.flags);
double result = alglib_impl::invfdistribution(a, b, y, &_alglib_env_state);
alglib_impl::ae_state_clear(&_alglib_env_state);
return *(reinterpret_cast<double *>(&result));
}
|
/*************************************************************************
Inverse of complemented F distribution
Finds the F density argument x such that the integral
from x to infinity of the F density is equal to the
given probability p.
This is accomplished using the inverse beta integral
function and the relations
z = incbi( df2/2, df1/2, p )
x = df2 (1-z) / (df1 z).
Note: the following relations hold for the inverse of
the uncomplemented F distribution:
z = incbi( df1/2, df2/2, p )
x = df2 z / (df1 (1-z)).
ACCURACY:
Tested at random points (a,b,p).
a,b Relative error:
arithmetic domain # trials peak rms
For p between .001 and 1:
IEEE 1,100 100000 8.3e-15 4.7e-16
IEEE 1,10000 100000 2.1e-11 1.4e-13
For p between 10^-6 and 10^-3:
IEEE 1,100 50000 1.3e-12 8.4e-15
IEEE 1,10000 50000 3.0e-12 4.8e-14
Cephes Math Library Release 2.8: June, 2000
Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
*************************************************************************/
|
https://github.com/Xrvitd/GCNO/blob/bcae63774a2ecd72f862a76eab570ab6d1ffe432/src/Optimization/ALGLIB/specialfunctions.cpp#L2156-L2174
|
bcae63774a2ecd72f862a76eab570ab6d1ffe432
|
DaisySeedProjects
|
github_2023
|
bkshepherd
|
cpp
|
DelayModule::~DelayModule
|
DelayModule::~DelayModule() {
// No Code Needed
}
|
// Destructor
|
https://github.com/bkshepherd/DaisySeedProjects/blob/c95af83f75aa866f1a8e12be56920ca11d76cf93/Software/GuitarPedal/Effect-Modules/delay_module.cpp#L140-L142
|
c95af83f75aa866f1a8e12be56920ca11d76cf93
|
sv06
|
github_2023
|
hillsoftware
|
cpp
|
FWRetract::M208
|
void FWRetract::M208() {
if (!parser.seen("FSRW")) return M208_report();
if (parser.seen('S')) settings.retract_recover_extra = parser.value_axis_units(E_AXIS);
if (parser.seen('F')) settings.retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('R')) settings.swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('W')) settings.swap_retract_recover_extra = parser.value_axis_units(E_AXIS);
}
|
/**
* M208: Set firmware un-retraction values
*
* S[+units] retract_recover_extra (in addition to M207 S*)
* W[+units] swap_retract_recover_extra (multi-extruder)
* F[units/min] retract_recover_feedrate_mm_s
* R[units/min] swap_retract_recover_feedrate_mm_s
*/
|
https://github.com/hillsoftware/sv06/blob/00d5ee302758703c9a959309716b5f720d750afc/Marlin/src/feature/fwretract.cpp#L233-L239
|
00d5ee302758703c9a959309716b5f720d750afc
|
sv06
|
github_2023
|
hillsoftware
|
cpp
|
fontgroup_drawstring
|
static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
const uint8_t *p = (uint8_t*)utf8_msg;
for (;;) {
lchar_t wc;
p = get_utf8_value_cb(p, cb_read_byte, wc);
if (!wc) break;
fontgroup_drawwchar(group, fnt_default, wc, userdata, cb_draw_ram);
}
}
|
/**
* @brief try to process a utf8 string
*
* @param pu8g : U8G pointer
* @param fnt_default : the default font
* @param utf8_msg : the UTF-8 string
* @param cb_read_byte : how to read the utf8_msg, from RAM or ROM (call read_byte_ram or pgm_read_byte)
* @param userdata : User's data
* @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actually it is to draw a one byte string in RAM)
*
* @return N/A
*
* Get the screen pixel width of a ROM UTF-8 string
*/
|
https://github.com/hillsoftware/sv06/blob/00d5ee302758703c9a959309716b5f720d750afc/Marlin/src/lcd/dogm/u8g_fontutf8.cpp#L106-L114
|
00d5ee302758703c9a959309716b5f720d750afc
|
sv06
|
github_2023
|
hillsoftware
|
cpp
|
MarlinUI::init_lcd
|
void MarlinUI::init_lcd() { DWIN_Startup(); }
|
// Initialize or re-initialize the LCD
|
https://github.com/hillsoftware/sv06/blob/00d5ee302758703c9a959309716b5f720d750afc/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp#L82-L82
|
00d5ee302758703c9a959309716b5f720d750afc
|
sv06
|
github_2023
|
hillsoftware
|
cpp
|
DWIN_Print_Header
|
void DWIN_Print_Header(const char *text = nullptr) {
static char headertxt[31] = ""; // Print header text
if (text) {
const int8_t size = _MIN(30U, strlen_P(text));
LOOP_L_N(i, size) headertxt[i] = text[i];
headertxt[size] = '\0';
}
if (checkkey == PrintProcess || checkkey == PrintDone) {
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 60, DWIN_WIDTH, 60+16);
DWINUI::Draw_CenteredString(60, headertxt);
}
}
|
// Update filename on print
|
https://github.com/hillsoftware/sv06/blob/00d5ee302758703c9a959309716b5f720d750afc/Marlin/src/lcd/e3v2/proui/dwin.cpp#L601-L612
|
00d5ee302758703c9a959309716b5f720d750afc
|
bemanitools
|
github_2023
|
djhackersdev
|
cpp
|
ImGui::DockContextNewFrameUpdateUndocking
|
void ImGui::DockContextNewFrameUpdateUndocking(ImGuiContext* ctx)
{
ImGuiContext& g = *ctx;
ImGuiDockContext* dc = &ctx->DockContext;
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
{
if (dc->Nodes.Data.Size > 0 || dc->Requests.Size > 0)
DockContextClearNodes(ctx, 0, true);
return;
}
// Setting NoSplit at runtime merges all nodes
if (g.IO.ConfigDockingNoSplit)
for (int n = 0; n < dc->Nodes.Data.Size; n++)
if (ImGuiDockNode* node = (ImGuiDockNode*)dc->Nodes.Data[n].val_p)
if (node->IsRootNode() && node->IsSplitNode())
{
DockBuilderRemoveNodeChildNodes(node->ID);
//dc->WantFullRebuild = true;
}
// Process full rebuild
#if 0
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C)))
dc->WantFullRebuild = true;
#endif
if (dc->WantFullRebuild)
{
DockContextRebuildNodes(ctx);
dc->WantFullRebuild = false;
}
// Process Undocking requests (we need to process them _before_ the UpdateMouseMovingWindowNewFrame call in NewFrame)
for (ImGuiDockRequest& req : dc->Requests)
{
if (req.Type == ImGuiDockRequestType_Undock && req.UndockTargetWindow)
DockContextProcessUndockWindow(ctx, req.UndockTargetWindow);
else if (req.Type == ImGuiDockRequestType_Undock && req.UndockTargetNode)
DockContextProcessUndockNode(ctx, req.UndockTargetNode);
}
}
|
// Docking context update function, called by NewFrame()
|
https://github.com/djhackersdev/bemanitools/blob/e0ff83f664f9282bca2fd5ddf1b4dc8cfa392c0a/src/main/imgui/imgui.cpp#L16843-L16883
|
e0ff83f664f9282bca2fd5ddf1b4dc8cfa392c0a
|
UltimateStarterKit
|
github_2023
|
hfjooste
|
cpp
|
UDialogueEntry::PreEditChange
|
void UDialogueEntry::PreEditChange(FProperty* PropertyAboutToChange)
{
Super::PreEditChange(PropertyAboutToChange);
if (PropertyAboutToChange->GetFName() != GET_MEMBER_NAME_CHECKED(UDialogueEntry, Transition) ||
Edges.Num() == 0)
{
return;
}
const FString Message = "Are you sure you want to update the transition type? "
"This will break all connections from the current node";
if (FMessageDialog::Open(EAppMsgType::YesNo, FText::FromString(Message)) != EAppReturnType::Yes)
{
BlockTransitionUpdate = true;
PreviousTransition = Transition;
}
}
|
/**
* @brief This is called when a property is about to be modified externally
* @param PropertyAboutToChange The property that is about to be modified
*/
|
https://github.com/hfjooste/UltimateStarterKit/blob/f8ba35499f4f9a0053abad502ff808d7a8c898ec/Plugins/USK/Source/USK/Dialogue/DialogueEntry.cpp#L40-L56
|
f8ba35499f4f9a0053abad502ff808d7a8c898ec
|
UltimateStarterKit
|
github_2023
|
hfjooste
|
cpp
|
UFpsCounter::UpdateVisibility
|
void UFpsCounter::UpdateVisibility(bool IsVisible)
{
const bool WasHidden = GetVisibility() == ESlateVisibility::Collapsed ||
GetVisibility() == ESlateVisibility::Hidden;
USK_LOG_INFO(*FString::Format(TEXT("Updating visibility to {0}"), { IsVisible }));
SetVisibility(IsVisible ? ESlateVisibility::Visible : ESlateVisibility::Collapsed);
if (WasHidden && IsVisible)
{
UpdateFramerateAfterDelay();
}
}
|
/**
* @brief Update the visibility of the widget
* @param IsVisible Is the widget visible?
*/
|
https://github.com/hfjooste/UltimateStarterKit/blob/f8ba35499f4f9a0053abad502ff808d7a8c898ec/Plugins/USK/Source/USK/Widgets/FpsCounter.cpp#L17-L28
|
f8ba35499f4f9a0053abad502ff808d7a8c898ec
|
BlueSCSI-v2
|
github_2023
|
BlueSCSI
|
cpp
|
platform_get_buttons
|
uint8_t platform_get_buttons()
{
return 0;
}
|
// Called periodically to get the state of any buttons installed on the platform.
// If none are installed the below function is fine.
|
https://github.com/BlueSCSI/BlueSCSI-v2/blob/24cc0fb957b984ebc756e5651e871bfdd2ad8168/lib/BlueSCSI_platform_template/BlueSCSI_platform.cpp#L64-L67
|
24cc0fb957b984ebc756e5651e871bfdd2ad8168
|
BlueSCSI-v2
|
github_2023
|
BlueSCSI
|
cpp
|
onSendFilePrep
|
void onSendFilePrep(char * dir_name)
{
char file_name[32+1];
scsiEnterPhase(DATA_OUT);
scsiRead(static_cast<uint8_t *>(static_cast<void *>(file_name)), 32+1, NULL);
file_name[32] = '\0';
debuglog("TOOLBOX OPEN FILE FOR WRITE: '", file_name, "'");
SD.chdir(dir_name);
gFile.open(file_name, FILE_WRITE);
SD.chdir("/");
if(gFile.isOpen() && gFile.isWritable())
{
gFile.rewind();
gFile.sync();
// do i need to manually set phase to status here?
return;
} else {
gFile.close();
scsiDev.status = CHECK_CONDITION;
scsiDev.target->sense.code = ILLEGAL_REQUEST;
//SCSI_ASC_INVALID_FIELD_IN_CDB
scsiDev.phase = STATUS;
}
}
|
/*
Prepares a file for receiving. The file name is null terminated in the scsi data.
*/
|
https://github.com/BlueSCSI/BlueSCSI-v2/blob/24cc0fb957b984ebc756e5651e871bfdd2ad8168/src/BlueSCSI_Toolbox.cpp#L251-L276
|
24cc0fb957b984ebc756e5651e871bfdd2ad8168
|
FPGA_Library
|
github_2023
|
suisuisi
|
cpp
|
MTFS::CreateDir
|
bool MTFS::CreateDir(char * szDir) {
PRM1B prm;
/* Error check that the file name length is acceptable.
*/
if (!mtds.FCheckName(szDir, clsCmdFs, cmdFsMkdir)) {
return false;
}
/* Send the command packet.
*/
prm.valB1 = strlen(szDir)+1;
mtds.MtdsProcessCmdWr(clsCmdFs, cmdFsMkdir, sizeof(prm), (uint8_t *)&prm,
prm.valB1, (uint8_t *)szDir);
/* Check for error and return failure.
*/
if (prhdrMtdsRet->sta != staCmdSuccess) {
return false;
}
/* Return success.
*/
return true;
}
|
/* ------------------------------------------------------------ */
/*** MTFS::CreateDir(szDir)
**
** Parameters:
** szDir - path string of directory to create
**
** Return Values:
** none
**
** Errors:
** Returns true if successful, false if not.
**
** Description:
** Create the specified directory.
*/
|
https://github.com/suisuisi/FPGA_Library/blob/1e33525198872d63ced48e8f0cebaa2419b9eb22/ThreePart/digilent_ip/ip/Pmods/PmodMTDS_v1_0/drivers/PmodMTDS_v1_0/src/MtdsFs.cpp#L285-L311
|
1e33525198872d63ced48e8f0cebaa2419b9eb22
|
FPGA_Library
|
github_2023
|
suisuisi
|
cpp
|
MTDS::GetTchMoveDelta
|
bool MTDS::GetTchMoveDelta(int16_t * pdxco, int16_t * pdyco) {
RET4B * pret = (RET4B *)&rgbMtdsRetVal[sizeof(RHDR)];
/* Send the command packet.
*/
MtdsProcessCmdWr(clsCmdUtil, cmdUtilGetTchMoveDelta, 0, 0, 0, 0);
/* Check for error and return failure if so.
*/
if (prhdrMtdsRet->sta != staCmdSuccess) {
return false;
}
/* Return the touch panel threshold settings.
*/
if (pdxco != 0) {
*pdxco = pret->valB1;
}
if (pdyco != 0) {
*pdyco = pret->valB2;
}
return true;
}
|
/* ------------------------------------------------------------ */
/*** MTDS::GetTchMoveDelta(pdxco, pdyco)
**
** Parameters:
** pdxco - pointer to variable to receive touch dxco threshold
** pdyco - pointer to variable to receive touch dyco threshold
**
** Return Values:
** Returns the current touch panel finger move threshold delta values
**
** Errors:
** Returns true if successful, false if error.
**
** Description:
** Returns the current finger move delta thresholds for the touch panel.
*/
|
https://github.com/suisuisi/FPGA_Library/blob/1e33525198872d63ced48e8f0cebaa2419b9eb22/ThreePart/digilent_ip/ip/Pmods/PmodMTDS_v1_0/drivers/PmodMTDS_v1_0/src/MtdsUtil.cpp#L661-L684
|
1e33525198872d63ced48e8f0cebaa2419b9eb22
|
FPGA_Library
|
github_2023
|
suisuisi
|
cpp
|
MTDS::end
|
void MTDS::end() {
fInitialized = false;
}
|
/* ------------------------------------------------------------ */
/*** MTDS::end()
**
** Parameters:
** none
**
** Return Values:
** none
**
** Errors:
** none
**
** Description:
** Tell the display shield that we aren't interested in talking to it anymore.
** After calling this, it is necessary to call MTDS::begin() in order to start
** using it again.
*/
|
https://github.com/suisuisi/FPGA_Library/blob/1e33525198872d63ced48e8f0cebaa2419b9eb22/ThreePart/digilent_ip/ip/Pmods/PmodMTDS_v1_0/drivers/PmodMTDS_v1_0/src/mtds.cpp#L229-L233
|
1e33525198872d63ced48e8f0cebaa2419b9eb22
|
DengFOC_Lib
|
github_2023
|
ToanTech
|
cpp
|
readTwoBytes
|
word readTwoBytes(int in_adr_hi, int in_adr_lo)
{
word retVal = -1;
/* 读低位 */
Wire.beginTransmission(_ams5600_Address);
Wire.write(in_adr_lo);
Wire.endTransmission();
Wire.requestFrom(_ams5600_Address, 1);
while(Wire.available() == 0);
int low = Wire.read();
/* 读高位 */
Wire.beginTransmission(_ams5600_Address);
Wire.write(in_adr_hi);
Wire.endTransmission();
Wire.requestFrom(_ams5600_Address, 1);
while(Wire.available() == 0);
int high = Wire.read();
retVal = (high << 8) | low;
return retVal;
}
|
//readTwoBytes(int in_adr_hi, int in_adr_lo)这段代码是一个函数,其目的是从I2C设备(在代码中的变量名为_ams5600_Address)中读取两个字节数据,并将其合并成一个16位的无符号整数返回。
//具体来说,函数接受两个整型参数in_adr_hi和in_adr_lo,它们用于指定需要读取的两个字节数据的地址。函数中首先通过Wire库开始I2C传输,向设备写入in_adr_lo和in_adr_hi分别作为数据地址,然后读取相应的字节数据。
//在每个Wire.requestFrom()调用之后,通过一个while循环等待数据接收完毕。然后读取接收到的低字节和高字节,并使用位运算将它们合并成一个16位的无符号整数。
//最后,返回合并后的整数。如果读取过程中出现错误或者函数没有成功读取到数据,则函数返回-1。
|
https://github.com/ToanTech/DengFOC_Lib/blob/8494ec97ea240691472a36fe3282c00fefcf32e2/DengFOC 库/V0.1 电压力矩 位置闭环/AS5600.cpp#L27-L50
|
8494ec97ea240691472a36fe3282c00fefcf32e2
|
ESPectrum
|
github_2023
|
EremusOne
|
cpp
|
VIA6522::VIA6522
|
VIA6522::VIA6522(int tag)
: m_tag(tag)
{
#if DEBUG6522
m_tick = 0;
#endif
}
|
/////////////////////////////////////////////////////////////////////////////////////////////
// VIA (6522 - Versatile Interface Adapter)
|
https://github.com/EremusOne/ESPectrum/blob/a501be723a08f3817787cd90fe77a45b476e38a4/components/fabgl/src/emudevs/VIA6522.cpp#L45-L51
|
a501be723a08f3817787cd90fe77a45b476e38a4
|
ESPectrum
|
github_2023
|
EremusOne
|
cpp
|
OSD::pref_rom_menu
|
void OSD::pref_rom_menu() {
menu_curopt = 1;
menu_saverect = true;
while (1) {
menu_level = 2;
uint8_t opt2 = menuRun(MENU_ROM_PREF[Config::lang]);
if (opt2) {
menu_level = 3;
menu_curopt = 1;
menu_saverect = true;
if (opt2 == 1) {
const string menu_res[] = {"48K","48Kes","48Kcs","Last"};
while (1) {
string rpref_menu = MENU_ROM_PREF_48[Config::lang];
menu_curopt = prepare_checkbox_menu(rpref_menu,Config::pref_romSet_48);
int opt3 = menuRun(rpref_menu);
menu_saverect = false;
if (opt3 == 0) break;
if (opt3 != menu_curopt) {
Config::pref_romSet_48 = menu_res[opt3 - 1];
Config::save("pref_romSet_48");
}
}
} else if (opt2 == 2) {
const string menu_res[] = {"128K","128Kes","+2","+2es","ZX81+","128Kcs","Last"};
while (1) {
string rpref_menu = MENU_ROM_PREF_128[Config::lang];
menu_curopt = prepare_checkbox_menu(rpref_menu,Config::pref_romSet_128);
int opt3 = menuRun(rpref_menu);
menu_saverect = false;
if (opt3 == 0) break;
if (opt3 != menu_curopt) {
Config::pref_romSet_128 = menu_res[opt3 - 1];
Config::save("pref_romSet_128");
}
}
} else if (opt2 == 3) {
const string menu_res[] = {"v1es","v1pt","v2es","v2pt","v3es","v3pt","v3en","TKcs","Last"};
while (1) {
string rpref_menu = MENU_ROM_PREF_TK90X[Config::lang];
menu_curopt = prepare_checkbox_menu(rpref_menu,Config::pref_romSet_TK90X);
int opt3 = menuRun(rpref_menu);
menu_saverect = false;
if (opt3 == 0) break;
if (opt3 != menu_curopt) {
Config::pref_romSet_TK90X = menu_res[opt3 - 1];
Config::save("pref_romSet_TK90X");
}
}
} else if (opt2 == 4) {
const string menu_res[] = {"95es","95pt","Last"};
while (1) {
string rpref_menu = MENU_ROM_PREF_TK95[Config::lang];
menu_curopt = prepare_checkbox_menu(rpref_menu,Config::pref_romSet_TK95);
int opt3 = menuRun(rpref_menu);
menu_saverect = false;
if (opt3 == 0) break;
if (opt3 != menu_curopt) {
Config::pref_romSet_TK95 = menu_res[opt3 - 1];
Config::save("pref_romSet_TK95");
}
}
}
menu_curopt = opt2;
menu_saverect = false;
} else
break;
}
menu_curopt = 3;
}
|
// *******************************************************************************************************
// PREFERRED ROM MENU
// *******************************************************************************************************
|
https://github.com/EremusOne/ESPectrum/blob/a501be723a08f3817787cd90fe77a45b476e38a4/src/OSDMain.cpp#L674-L790
|
a501be723a08f3817787cd90fe77a45b476e38a4
|
ps4-ezremote-client
|
github_2023
|
cy33hc
|
cpp
|
FtpClient::Noop
|
bool FtpClient::Noop()
{
if (!FtpSendCmd("NOOP", "25", mp_ftphandle))
return 0;
return 1;
}
|
/*
* send a NOOP cmd to keep connection alive
*
* return 1 if successful, 0 otherwise
*/
|
https://github.com/cy33hc/ps4-ezremote-client/blob/b7fe46cb94310f8591275d3c34107b5944137a4a/source/clients/ftpclient.cpp#L1190-L1195
|
b7fe46cb94310f8591275d3c34107b5944137a4a
|
d2gl
|
github_2023
|
bayaraa
|
cpp
|
ImBezierCubicClosestPoint
|
ImVec2 ImBezierCubicClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments)
{
IM_ASSERT(num_segments > 0); // Use ImBezierCubicClosestPointCasteljau()
ImVec2 p_last = p1;
ImVec2 p_closest;
float p_closest_dist2 = FLT_MAX;
float t_step = 1.0f / (float)num_segments;
for (int i_step = 1; i_step <= num_segments; i_step++)
{
ImVec2 p_current = ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step);
ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);
float dist2 = ImLengthSqr(p - p_line);
if (dist2 < p_closest_dist2)
{
p_closest = p_line;
p_closest_dist2 = dist2;
}
p_last = p_current;
}
return p_closest;
}
|
//-----------------------------------------------------------------------------
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
//-----------------------------------------------------------------------------
|
https://github.com/bayaraa/d2gl/blob/919df3528de5c5c1b41b326cf68821cd1981c42c/d2gl/vendor/include/imgui/imgui.cpp#L1510-L1530
|
919df3528de5c5c1b41b326cf68821cd1981c42c
|
d2gl
|
github_2023
|
bayaraa
|
cpp
|
FindHoveredWindow
|
static void FindHoveredWindow()
{
ImGuiContext& g = *GImGui;
ImGuiWindow* hovered_window = NULL;
ImGuiWindow* hovered_window_ignoring_moving_window = NULL;
if (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoMouseInputs))
hovered_window = g.MovingWindow;
ImVec2 padding_regular = g.Style.TouchExtraPadding;
ImVec2 padding_for_resize = g.IO.ConfigWindowsResizeFromEdges ? g.WindowsHoverPadding : padding_regular;
for (int i = g.Windows.Size - 1; i >= 0; i--)
{
ImGuiWindow* window = g.Windows[i];
IM_MSVC_WARNING_SUPPRESS(28182); // [Static Analyzer] Dereferencing NULL pointer.
if (!window->Active || window->Hidden)
continue;
if (window->Flags & ImGuiWindowFlags_NoMouseInputs)
continue;
// Using the clipped AABB, a child window will typically be clipped by its parent (not always)
ImRect bb(window->OuterRectClipped);
if (window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize))
bb.Expand(padding_regular);
else
bb.Expand(padding_for_resize);
if (!bb.Contains(g.IO.MousePos))
continue;
// Support for one rectangular hole in any given window
// FIXME: Consider generalizing hit-testing override (with more generic data, callback, etc.) (#1512)
if (window->HitTestHoleSize.x != 0)
{
ImVec2 hole_pos(window->Pos.x + (float)window->HitTestHoleOffset.x, window->Pos.y + (float)window->HitTestHoleOffset.y);
ImVec2 hole_size((float)window->HitTestHoleSize.x, (float)window->HitTestHoleSize.y);
if (ImRect(hole_pos, hole_pos + hole_size).Contains(g.IO.MousePos))
continue;
}
if (hovered_window == NULL)
hovered_window = window;
IM_MSVC_WARNING_SUPPRESS(28182); // [Static Analyzer] Dereferencing NULL pointer.
if (hovered_window_ignoring_moving_window == NULL && (!g.MovingWindow || window->RootWindow != g.MovingWindow->RootWindow))
hovered_window_ignoring_moving_window = window;
if (hovered_window && hovered_window_ignoring_moving_window)
break;
}
g.HoveredWindow = hovered_window;
g.HoveredWindowUnderMovingWindow = hovered_window_ignoring_moving_window;
}
|
// Find window given position, search front-to-back
// FIXME: Note that we have an inconsequential lag here: OuterRectClipped is updated in Begin(), so windows moved programmatically
// with SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is
// called, aka before the next Begin(). Moving window isn't affected.
|
https://github.com/bayaraa/d2gl/blob/919df3528de5c5c1b41b326cf68821cd1981c42c/d2gl/vendor/include/imgui/imgui.cpp#L4988-L5038
|
919df3528de5c5c1b41b326cf68821cd1981c42c
|
dingo-store
|
github_2023
|
dingodb
|
cpp
|
BdbRawEngine::OpenDb
|
int32_t BdbRawEngine::OpenDb(Db** dbpp, const char* file_name, DbEnv* envp, uint32_t extra_flags) {
int ret;
uint32_t open_flags;
DbTxn* txn = nullptr;
try {
int ret = envp->txn_begin(nullptr, &txn, 0);
if (ret != 0) {
DINGO_LOG(ERROR) << fmt::format("[bdb] txn begin failed ret: {}.", ret);
return -1;
}
bdb_transaction_alive_count << 1;
Db* db = new Db(envp, 0);
// Point to the new'd Db
*dbpp = db;
db->set_pagesize(FLAGS_bdb_page_size);
if (extra_flags != 0) {
ret = db->set_flags(extra_flags);
}
// Now open the database */
open_flags = DB_CREATE | // Allow database creation
// DB_READ_UNCOMMITTED | // Allow uncommitted reads
// DB_AUTO_COMMIT | // Allow autocommit
DB_MULTIVERSION | // Multiversion concurrency control
DB_THREAD; // Cause the database to be free-threade1
db->open(txn, // Txn pointer
file_name, // File name
nullptr, // Logical db name
DB_BTREE, // Database type (using btree)
open_flags, // Open flags
0); // File mode. Using defaults
// commit
try {
ret = bdb::BdbHelper::TxnCommit(&txn);
if (ret == 0) {
return 0;
} else {
DINGO_LOG(ERROR) << fmt::format("[bdb] txn commit failed, ret: {}.", ret);
}
} catch (DbException& db_exception) {
bdb::BdbHelper::PrintEnvStat(envp);
DINGO_LOG(ERROR) << fmt::format("[bdb] error on txn commit: {} {}.", db_exception.get_errno(),
db_exception.what());
ret = -1;
}
if (ret != 0) {
DINGO_LOG(ERROR) << fmt::format("[bdb] error on txn commit, ret: {}.", ret);
return -1;
}
} catch (DbException& db_exception) {
bdb::BdbHelper::PrintEnvStat(envp);
DINGO_LOG(ERROR) << fmt::format("OpenDb: db open failed: {} {}.", db_exception.get_errno(), db_exception.what());
bdb::BdbHelper::TxnAbort(&txn);
return -1;
}
return 0;
}
|
// namespace bdb
// Open a BDB database
|
https://github.com/dingodb/dingo-store/blob/6becbfa5ab7ed9327b5b260d2390b0344918c396/src/engine/bdb_raw_engine.cc#L1886-L1952
|
6becbfa5ab7ed9327b5b260d2390b0344918c396
|
dingo-store
|
github_2023
|
dingodb
|
cpp
|
ServiceHelper::ValidateRegionState
|
butil::Status ServiceHelper::ValidateRegionState(store::RegionPtr region) {
// Check is exist region.
if (region == nullptr) {
return butil::Status(pb::error::EREGION_NOT_FOUND, "Not found region");
}
if (region->State() == pb::common::StoreRegionState::NEW) {
return butil::Status(pb::error::EREGION_UNAVAILABLE, "Region(%lu) is new, waiting later", region->Id());
}
if (region->State() == pb::common::StoreRegionState::STANDBY) {
return butil::Status(pb::error::EREGION_UNAVAILABLE, "Region(%lu) is standby, waiting later", region->Id());
}
if (region->State() == pb::common::StoreRegionState::DELETING) {
return butil::Status(pb::error::EREGION_UNAVAILABLE, "Region(%lu) is deleting", region->Id());
}
if (region->State() == pb::common::StoreRegionState::DELETED) {
return butil::Status(pb::error::EREGION_UNAVAILABLE, "Region(%lu) is deleted", region->Id());
}
if (region->State() == pb::common::StoreRegionState::ORPHAN) {
return butil::Status(pb::error::EREGION_UNAVAILABLE, "Region(%lu) is orphan", region->Id());
}
if (region->State() == pb::common::StoreRegionState::TOMBSTONE) {
return butil::Status(pb::error::EREGION_UNAVAILABLE, "Region(%lu) is tombstone", region->Id());
}
return butil::Status();
}
|
// Validate region state
|
https://github.com/dingodb/dingo-store/blob/6becbfa5ab7ed9327b5b260d2390b0344918c396/src/server/service_helper.cc#L88-L113
|
6becbfa5ab7ed9327b5b260d2390b0344918c396
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
GetBoolAssertionFailureMessage
|
std::string GetBoolAssertionFailureMessage(
const AssertionResult& assertion_result,
const char* expression_text,
const char* actual_predicate_value,
const char* expected_predicate_value) {
const char* actual_message = assertion_result.message();
Message msg;
msg << "Value of: " << expression_text
<< "\n Actual: " << actual_predicate_value;
if (actual_message[0] != '\0')
msg << " (" << actual_message << ")";
msg << "\nExpected: " << expected_predicate_value;
return msg.GetString();
}
|
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/libraries/gtest/src/gtest.cc#L1346-L1359
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
ParseStringFlag
|
bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
// Gets the value of the flag as a string.
const char* const value_str = ParseFlagValue(str, flag, false);
// Aborts if the parsing failed.
if (value_str == NULL) return false;
// Sets *value to the value of the flag.
*value = value_str;
return true;
}
|
// Parses a string for a string flag, in the form of
// "--flag=value".
//
// On success, stores the value of the flag in *value, and returns
// true. On failure, returns false without changing *value.
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/libraries/gtest/src/gtest.cc#L5087-L5097
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
TEST
|
TEST(MessageTest, StreamsString) {
const ::std::string str("Hello");
EXPECT_EQ("Hello", (Message() << str).GetString());
}
|
// Tests streaming std::string.
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/libraries/gtest/test/gtest-message_test.cc#L105-L108
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
TEST_F
|
TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {
ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
Bool(++n1_),
Bool(++n2_));
finished_ = true;
}
|
// Tests a successful ASSERT_PRED_FORMAT2 where the
// predicate-formatter is a functor on a user-defined type (Bool).
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/libraries/gtest/test/gtest_pred_impl_unittest.cc#L835-L840
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
PredFunction3Int
|
bool PredFunction3Int(int v1, int v2, int v3) {
return v1 + v2 + v3 > 0;
}
|
// The following two functions are needed to circumvent a bug in
// gcc 2.95.3, which sometimes has problem with the above template
// function.
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/libraries/gtest/test/gtest_pred_impl_unittest.cc#L900-L902
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
TEST_F
|
TEST_F(DoubleTest, Infinity) {
EXPECT_DOUBLE_EQ(values_.infinity, values_.close_to_infinity);
EXPECT_DOUBLE_EQ(-values_.infinity, -values_.close_to_infinity);
#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.infinity, -values_.infinity),
"-values_.infinity");
// This is interesting as the representations of infinity_ and nan1_
// are only 1 DLP apart.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.infinity, values_.nan1),
"values_.nan1");
#endif // !GTEST_OS_SYMBIAN
}
|
// Tests comparing with infinity.
//
// This ensures that no overflow occurs when comparing numbers whose
// absolute value is very large.
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/libraries/gtest/test/gtest_unittest.cc#L2976-L2989
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
GlobalSfMpy
|
github_2023
|
zhangganlin
|
cpp
|
TEST
|
TEST(SPRTTest, CalculateSPRTDecisionThreshold) {
double sigma = 0.05;
double epsilon = 0.1;
double decision_threshold = CalculateSPRTDecisionThreshold(sigma, epsilon);
VLOG(0) << "Decision threshold: " << decision_threshold;
// Test with change of values for timing.
decision_threshold = CalculateSPRTDecisionThreshold(sigma, epsilon, 200, 3);
VLOG(0) << "Decision threshold: " << decision_threshold;
}
|
// TODO(cmsweeney): Make this test a verification (i.e. is the value coming out
// accurate?) instead of just a sanity check.
|
https://github.com/zhangganlin/GlobalSfMpy/blob/ac6a0564d84e1d6e9a4077195e384d379aa20492/thirdparty/TheiaSfM/src/theia/math/probability/sprt_test.cc#L92-L101
|
ac6a0564d84e1d6e9a4077195e384d379aa20492
|
Vita3K-Android
|
github_2023
|
Vita3K
|
cpp
|
decode_dual_swizzle
|
Swizzle4 decode_dual_swizzle(Imm4 swizz, const bool extended, const bool vec4) {
static Swizzle4 swizz_v4_std[] = {
SWIZZLE_CHANNEL_4(X, X, X, X),
SWIZZLE_CHANNEL_4(Y, Y, Y, Y),
SWIZZLE_CHANNEL_4(Z, Z, Z, Z),
SWIZZLE_CHANNEL_4(W, W, W, W),
SWIZZLE_CHANNEL_4(X, Y, Z, W),
SWIZZLE_CHANNEL_4(Y, Z, W, W),
SWIZZLE_CHANNEL_4(X, Y, Z, Z),
SWIZZLE_CHANNEL_4(X, X, Y, Z),
SWIZZLE_CHANNEL_4(X, Y, X, Y),
SWIZZLE_CHANNEL_4(X, Y, W, Z),
SWIZZLE_CHANNEL_4(Z, X, Y, W),
SWIZZLE_CHANNEL_4(Z, W, Z, W),
SWIZZLE_CHANNEL_4(0, 0, 0, 0),
SWIZZLE_CHANNEL_4(H, H, H, H),
SWIZZLE_CHANNEL_4(1, 1, 1, 1),
SWIZZLE_CHANNEL_4(2, 2, 2, 2),
};
static Swizzle4 swizz_v4_ext[] = {
SWIZZLE_CHANNEL_4(Y, Z, X, W),
SWIZZLE_CHANNEL_4(Z, W, X, Y),
SWIZZLE_CHANNEL_4(X, Z, W, Y),
SWIZZLE_CHANNEL_4(Y, Y, W, W),
SWIZZLE_CHANNEL_4(W, Y, Z, W),
SWIZZLE_CHANNEL_4(W, Z, W, Z),
SWIZZLE_CHANNEL_4(X, Y, Z, X),
SWIZZLE_CHANNEL_4(Z, Z, W, W),
SWIZZLE_CHANNEL_4(X, W, Z, X),
SWIZZLE_CHANNEL_4(Y, Y, Y, X),
SWIZZLE_CHANNEL_4(Y, Y, Y, Z),
SWIZZLE_CHANNEL_4(Z, W, Z, W),
SWIZZLE_CHANNEL_4(Y, Z, X, Z),
SWIZZLE_CHANNEL_4(X, X, Y, Y),
SWIZZLE_CHANNEL_4(X, Z, W, W),
SWIZZLE_CHANNEL_4(X, Y, Z, 1),
};
static Swizzle3 swizz_v3_std[] = {
SWIZZLE_CHANNEL_3(X, X, X),
SWIZZLE_CHANNEL_3(Y, Y, Y),
SWIZZLE_CHANNEL_3(Z, Z, Z),
SWIZZLE_CHANNEL_3(W, W, W),
SWIZZLE_CHANNEL_3(X, Y, Z),
SWIZZLE_CHANNEL_3(Y, Z, W),
SWIZZLE_CHANNEL_3(X, X, Y),
SWIZZLE_CHANNEL_3(X, Y, X),
SWIZZLE_CHANNEL_3(Y, Y, X),
SWIZZLE_CHANNEL_3(Y, Y, Z),
SWIZZLE_CHANNEL_3(Z, X, Y),
SWIZZLE_CHANNEL_3(X, Z, Y),
SWIZZLE_CHANNEL_3(0, 0, 0),
SWIZZLE_CHANNEL_3(H, H, H),
SWIZZLE_CHANNEL_3(1, 1, 1),
SWIZZLE_CHANNEL_3(2, 2, 2),
};
static Swizzle3 swizz_v3_ext[] = {
SWIZZLE_CHANNEL_3(X, Y, Y),
SWIZZLE_CHANNEL_3(Y, X, Y),
SWIZZLE_CHANNEL_3(X, X, Z),
SWIZZLE_CHANNEL_3(Y, X, X),
SWIZZLE_CHANNEL_3(X, Y, 0),
SWIZZLE_CHANNEL_3(X, 1, 0),
SWIZZLE_CHANNEL_3(X, Z, Y),
SWIZZLE_CHANNEL_3(Y, Z, X),
SWIZZLE_CHANNEL_3(Z, Y, X),
SWIZZLE_CHANNEL_3(Z, Z, Y),
SWIZZLE_CHANNEL_3(X, Y, 1),
SWIZZLE_CHANNEL_3_UNDEFINED,
SWIZZLE_CHANNEL_3_UNDEFINED,
SWIZZLE_CHANNEL_3_UNDEFINED,
SWIZZLE_CHANNEL_3_UNDEFINED,
SWIZZLE_CHANNEL_3_UNDEFINED,
};
if (vec4) {
if (extended)
return swizz_v4_ext[swizz];
else
return swizz_v4_std[swizz];
} else {
if (extended)
return to_swizzle4(swizz_v3_ext[swizz]);
else
return to_swizzle4(swizz_v3_std[swizz]);
}
return SWIZZLE_CHANNEL_4_UNDEFINED;
}
|
// Dual has it's own unique swizzle.
|
https://github.com/Vita3K/Vita3K-Android/blob/a62e232024d21ca4a74d16a5d5cacedf66bd39ea/vita3k/shader/src/usse_decode_helpers.cpp#L263-L353
|
a62e232024d21ca4a74d16a5d5cacedf66bd39ea
|
tt-metal
|
github_2023
|
tenstorrent
|
cpp
|
create_owned_buffer_from_vector_of_floats
|
tt::tt_metal::OwnedBuffer create_owned_buffer_from_vector_of_floats(
const std::vector<float>& data, DataType data_type) {
switch (data_type) {
case DataType::BFLOAT8_B: {
auto uint32_vector = pack_fp32_vec_as_bfp8_tiles(data, /*row_major_input=*/false, /*is_exp_a=*/false);
return tt::tt_metal::owned_buffer::create<uint32_t>(std::move(uint32_vector));
}
case DataType::BFLOAT4_B: {
auto uint32_vector = pack_fp32_vec_as_bfp4_tiles(data, /*row_major_input=*/false, /*is_exp_a=*/false);
return tt::tt_metal::owned_buffer::create<uint32_t>(std::move(uint32_vector));
}
case DataType::FLOAT32: {
auto data_copy = data;
return tt::tt_metal::owned_buffer::create<float>(std::move(data_copy));
}
case DataType::BFLOAT16: {
std::vector<bfloat16> bfloat16_data(data.size());
std::transform(std::begin(data), std::end(data), std::begin(bfloat16_data), [](float value) {
return bfloat16(value);
});
return tt::tt_metal::owned_buffer::create<bfloat16>(std::move(bfloat16_data));
}
default: {
throw std::runtime_error("Cannot create a host buffer!");
}
}
}
|
// copypaste from deprecated tensor pybinds ttnn
|
https://github.com/tenstorrent/tt-metal/blob/941b34cff33ce2953cf984ec8898af25dbfbfbb3/tt-train/sources/ttml/core/tt_tensor_utils.cpp#L57-L83
|
941b34cff33ce2953cf984ec8898af25dbfbfbb3
|
tt-metal
|
github_2023
|
tenstorrent
|
cpp
|
FDKernel::GetTunnelStop
|
uint32_t FDKernel::GetTunnelStop(chip_id_t device_id) {
chip_id_t mmio_device_id = tt::Cluster::instance().get_associated_mmio_device(device_id);
for (auto tunnel : tt::Cluster::instance().get_tunnels_from_mmio_device(mmio_device_id)) {
for (uint32_t idx = 0; idx < tunnel.size(); idx++) {
if (tunnel[idx] == device_id) {
return idx;
}
}
}
TT_ASSERT(false, "Could not find tunnel stop of Device {}", device_id);
return 0;
}
|
// Helper function to get the tunnel stop of current device
|
https://github.com/tenstorrent/tt-metal/blob/941b34cff33ce2953cf984ec8898af25dbfbfbb3/tt_metal/impl/dispatch/kernel_config/fd_kernel.cpp#L51-L62
|
941b34cff33ce2953cf984ec8898af25dbfbfbb3
|
HImGuiEditor
|
github_2023
|
Half-People
|
cpp
|
TextEditCallbackStub
|
static int TextEditCallbackStub(ImGuiInputTextCallbackData* data)
{
ExampleAppConsole* console = (ExampleAppConsole*)data->UserData;
return console->TextEditCallback(data);
}
|
// In C++11 you'd be better off using lambdas for this sort of forwarding callbacks
|
https://github.com/Half-People/HImGuiEditor/blob/a0d29c1ad484cafdd1410ed4bc6568bf02c14beb/HalfPeopleStudioImGuiEditor/DependentFile/API/ImGui/imgui_demo.cpp#L6944-L6948
|
a0d29c1ad484cafdd1410ed4bc6568bf02c14beb
|
HImGuiEditor
|
github_2023
|
Half-People
|
cpp
|
ImGui_ImplGlfw_UpdateKeyModifiers
|
static void ImGui_ImplGlfw_UpdateKeyModifiers(GLFWwindow* window)
{
ImGuiIO& io = ImGui::GetIO();
io.AddKeyEvent(ImGuiMod_Ctrl, (glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS));
io.AddKeyEvent(ImGuiMod_Shift, (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS));
io.AddKeyEvent(ImGuiMod_Alt, (glfwGetKey(window, GLFW_KEY_LEFT_ALT) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS));
io.AddKeyEvent(ImGuiMod_Super, (glfwGetKey(window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS));
}
|
// X11 does not include current pressed/released modifier key in 'mods' flags submitted by GLFW
// See https://github.com/ocornut/imgui/issues/6034 and https://github.com/glfw/glfw/issues/1630
|
https://github.com/Half-People/HImGuiEditor/blob/a0d29c1ad484cafdd1410ed4bc6568bf02c14beb/HalfPeopleStudioImGuiEditor/DependentFile/API/ImGui/backends/imgui_impl_glfw.cpp#L309-L316
|
a0d29c1ad484cafdd1410ed4bc6568bf02c14beb
|
HImGuiEditor
|
github_2023
|
Half-People
|
cpp
|
LogTextV
|
static inline void LogTextV(ImGuiContext& g, const char* fmt, va_list args)
{
if (g.LogFile)
{
g.LogBuffer.Buf.resize(0);
g.LogBuffer.appendfv(fmt, args);
ImFileWrite(g.LogBuffer.c_str(), sizeof(char), (ImU64)g.LogBuffer.size(), g.LogFile);
}
else
{
g.LogBuffer.appendfv(fmt, args);
}
}
|
//-----------------------------------------------------------------------------
// [SECTION] LOGGING/CAPTURING
//-----------------------------------------------------------------------------
// All text output from the interface can be captured into tty/file/clipboard.
// By default, tree nodes are automatically opened during logging.
//-----------------------------------------------------------------------------
// Pass text data straight to log (without being displayed)
|
https://github.com/Half-People/HImGuiEditor/blob/a0d29c1ad484cafdd1410ed4bc6568bf02c14beb/HalfPeopleStudioImGuiEditor/ImGui/imgui.cpp#L13263-L13275
|
a0d29c1ad484cafdd1410ed4bc6568bf02c14beb
|
HImGuiEditor
|
github_2023
|
Half-People
|
cpp
|
ImGui::CallContextHooks
|
void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type)
{
ImGuiContext& g = *ctx;
for (int n = 0; n < g.Hooks.Size; n++)
if (g.Hooks[n].Type == hook_type)
g.Hooks[n].Callback(&g, &g.Hooks[n]);
}
|
// Call context hooks (used by e.g. test engine)
// We assume a small number of hooks so all stored in same array
|
https://github.com/Half-People/HImGuiEditor/blob/a0d29c1ad484cafdd1410ed4bc6568bf02c14beb/HalfPeopleStudioImGuiEditor/Plugin/Plugin-Example/HImGuiEditorPlugin/HImGuiEditorPlugin/ImGui/imgui.cpp#L3751-L3757
|
a0d29c1ad484cafdd1410ed4bc6568bf02c14beb
|
HImGuiEditor
|
github_2023
|
Half-People
|
cpp
|
LogTextV
|
static inline void LogTextV(ImGuiContext& g, const char* fmt, va_list args)
{
if (g.LogFile)
{
g.LogBuffer.Buf.resize(0);
g.LogBuffer.appendfv(fmt, args);
ImFileWrite(g.LogBuffer.c_str(), sizeof(char), (ImU64)g.LogBuffer.size(), g.LogFile);
}
else
{
g.LogBuffer.appendfv(fmt, args);
}
}
|
//-----------------------------------------------------------------------------
// [SECTION] LOGGING/CAPTURING
//-----------------------------------------------------------------------------
// All text output from the interface can be captured into tty/file/clipboard.
// By default, tree nodes are automatically opened during logging.
//-----------------------------------------------------------------------------
// Pass text data straight to log (without being displayed)
|
https://github.com/Half-People/HImGuiEditor/blob/a0d29c1ad484cafdd1410ed4bc6568bf02c14beb/HalfPeopleStudioImGuiEditor/Plugin/Plugin-Example/HImGuiEditorPlugin/HImGuiEditorPlugin/ImGui/imgui.cpp#L13263-L13275
|
a0d29c1ad484cafdd1410ed4bc6568bf02c14beb
|
HImGuiEditor
|
github_2023
|
Half-People
|
cpp
|
ImGui_ImplDX12_CreateWindow
|
static void ImGui_ImplDX12_CreateWindow(ImGuiViewport* viewport)
{
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
ImGui_ImplDX12_ViewportData* vd = IM_NEW(ImGui_ImplDX12_ViewportData)(bd->numFramesInFlight);
viewport->RendererUserData = vd;
// PlatformHandleRaw should always be a HWND, whereas PlatformHandle might be a higher-level handle (e.g. GLFWWindow*, SDL_Window*).
// Some backends will leave PlatformHandleRaw NULL, in which case we assume PlatformHandle will contain the HWND.
HWND hwnd = viewport->PlatformHandleRaw ? (HWND)viewport->PlatformHandleRaw : (HWND)viewport->PlatformHandle;
IM_ASSERT(hwnd != 0);
vd->FrameIndex = UINT_MAX;
// Create command queue.
D3D12_COMMAND_QUEUE_DESC queue_desc = {};
queue_desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
HRESULT res = S_OK;
res = bd->pd3dDevice->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&vd->CommandQueue));
IM_ASSERT(res == S_OK);
// Create command allocator.
for (UINT i = 0; i < bd->numFramesInFlight; ++i)
{
res = bd->pd3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&vd->FrameCtx[i].CommandAllocator));
IM_ASSERT(res == S_OK);
}
// Create command list.
res = bd->pd3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, vd->FrameCtx[0].CommandAllocator, nullptr, IID_PPV_ARGS(&vd->CommandList));
IM_ASSERT(res == S_OK);
vd->CommandList->Close();
// Create fence.
res = bd->pd3dDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&vd->Fence));
IM_ASSERT(res == S_OK);
vd->FenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
IM_ASSERT(vd->FenceEvent != nullptr);
// Create swap chain
// FIXME-VIEWPORT: May want to copy/inherit swap chain settings from the user/application.
DXGI_SWAP_CHAIN_DESC1 sd1;
ZeroMemory(&sd1, sizeof(sd1));
sd1.BufferCount = bd->numFramesInFlight;
sd1.Width = (UINT)viewport->Size.x;
sd1.Height = (UINT)viewport->Size.y;
sd1.Format = bd->RTVFormat;
sd1.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd1.SampleDesc.Count = 1;
sd1.SampleDesc.Quality = 0;
sd1.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
sd1.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
sd1.Scaling = DXGI_SCALING_STRETCH;
sd1.Stereo = FALSE;
IDXGIFactory4* dxgi_factory = nullptr;
res = ::CreateDXGIFactory1(IID_PPV_ARGS(&dxgi_factory));
IM_ASSERT(res == S_OK);
IDXGISwapChain1* swap_chain = nullptr;
res = dxgi_factory->CreateSwapChainForHwnd(vd->CommandQueue, hwnd, &sd1, nullptr, nullptr, &swap_chain);
IM_ASSERT(res == S_OK);
dxgi_factory->Release();
// Or swapChain.As(&mSwapChain)
IM_ASSERT(vd->SwapChain == nullptr);
swap_chain->QueryInterface(IID_PPV_ARGS(&vd->SwapChain));
swap_chain->Release();
// Create the render targets
if (vd->SwapChain)
{
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
desc.NumDescriptors = bd->numFramesInFlight;
desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
desc.NodeMask = 1;
HRESULT hr = bd->pd3dDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&vd->RtvDescHeap));
IM_ASSERT(hr == S_OK);
SIZE_T rtv_descriptor_size = bd->pd3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
D3D12_CPU_DESCRIPTOR_HANDLE rtv_handle = vd->RtvDescHeap->GetCPUDescriptorHandleForHeapStart();
for (UINT i = 0; i < bd->numFramesInFlight; i++)
{
vd->FrameCtx[i].RenderTargetCpuDescriptors = rtv_handle;
rtv_handle.ptr += rtv_descriptor_size;
}
ID3D12Resource* back_buffer;
for (UINT i = 0; i < bd->numFramesInFlight; i++)
{
IM_ASSERT(vd->FrameCtx[i].RenderTarget == nullptr);
vd->SwapChain->GetBuffer(i, IID_PPV_ARGS(&back_buffer));
bd->pd3dDevice->CreateRenderTargetView(back_buffer, nullptr, vd->FrameCtx[i].RenderTargetCpuDescriptors);
vd->FrameCtx[i].RenderTarget = back_buffer;
}
}
for (UINT i = 0; i < bd->numFramesInFlight; i++)
ImGui_ImplDX12_DestroyRenderBuffers(&vd->FrameRenderBuffers[i]);
}
|
//--------------------------------------------------------------------------------------------------------
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
// This is an _advanced_ and _optional_ feature, allowing the backend to create and handle multiple viewports simultaneously.
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
//--------------------------------------------------------------------------------------------------------
|
https://github.com/Half-People/HImGuiEditor/blob/a0d29c1ad484cafdd1410ed4bc6568bf02c14beb/x64/Release/DependentFile/API/ImGui/backends/imgui_impl_dx12.cpp#L843-L947
|
a0d29c1ad484cafdd1410ed4bc6568bf02c14beb
|
T-Display-S3-AMOLED
|
github_2023
|
Xinyuan-LilyGO
|
cpp
|
TFT_eSPI::setCursor
|
void TFT_eSPI::setCursor(int16_t x, int16_t y, uint8_t font)
{
textfont = font;
cursor_x = x;
cursor_y = y;
}
|
/***************************************************************************************
** Function name: setCursor
** Description: Set the text cursor x,y position and font
***************************************************************************************/
|
https://github.com/Xinyuan-LilyGO/T-Display-S3-AMOLED/blob/edd133335c9f7c38d1e9be2d0eb67371f1f6428e/lib/TFT_eSPI/TFT_eSPI.cpp#L2866-L2871
|
edd133335c9f7c38d1e9be2d0eb67371f1f6428e
|
catalyst
|
github_2023
|
PennyLaneAI
|
cpp
|
createGradientPostprocessingPass
|
std::unique_ptr<Pass> createGradientPostprocessingPass()
{
return std::make_unique<gradient::GradientPostprocessingPass>();
}
|
// namespace gradient
|
https://github.com/PennyLaneAI/catalyst/blob/729d468ad1bec692242c6b20560a2b9922debb31/mlir/lib/Gradient/Transforms/gradient_postprocess.cpp#L54-L57
|
729d468ad1bec692242c6b20560a2b9922debb31
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.