Skip to content

Instantly share code, notes, and snippets.

@namelessvoid
namelessvoid / ReadShaderStorageBufferCallback.cpp
Created November 23, 2016 13:38
Reading back data from shader storage buffer in an OpenSceneGraph Drawable::DrawCallback
class ReadShaderStorageBufferDataCallback : public osg::Drawable::DrawCallback
{
public:
ReadShaderBufferDataCallback(osg::BufferObject& bufferObject)
: _bufferObject(&bufferObject)
{}
virtual void drawImplementation(osg::RenderInfo& renderInfo, const osg::Drawable* runnable) const
{
// std::cout << "ReadShaderBufferDataCalback executed." << std::endl << std::flush;
@namelessvoid
namelessvoid / GetPIEWorld.cpp
Created August 6, 2016 18:27
Code to access the PIE world inside an UE automation test. Thanks to Adric and hyperdr1ve on answers.unrealengine.com: https://answers.unrealengine.com/questions/303577/automation-testing-on-binary-engine-is-broken.html
// Many thanks to Adric Worley and hyperdr1ve on answers.unrealengine.com
// https://answers.unrealengine.com/questions/303577/automation-testing-on-binary-engine-is-broken.html
// Awesome!
UWorld* GetWorld()
{
if (GEngine)
{
if (FWorldContext* World = GEngine->GetWorldContextFromPIEInstance(0))
{
@namelessvoid
namelessvoid / statemachine.cpp
Created June 10, 2015 17:55
A very simple (and unoptimized ;) ) state machine.
#include "statemachine.hpp"
#include <iostream>
StateMachine::StateMachine()
: nextStateId(1),
nextActionId(1)
{
}
@namelessvoid
namelessvoid / statemachine_example.cpp
Created June 10, 2015 09:50
Sample usage of the state machine.
#include <iostream>
#include "statemachine.hpp"
using namespace std;
int main()
{
cout << "State machine" << endl;