Skip to content

Instantly share code, notes, and snippets.

View trentpolack's full-sized avatar

Trent Polack trentpolack

View GitHub Profile
@syoyo
syoyo / gist:831c4b1926aa88c0da9221211723da2d
Created December 17, 2018 13:12
C++ implementaion of "A simple method to construct isotropic quasirandom blue noise point sequences"
//
// C++ implementaion of "A simple method to construct isotropic quasirandom blue
// noise point sequences"
//
// http://extremelearning.com.au/a-simple-method-to-construct-isotropic-quasirandom-blue-noise-point-sequences/
//
// Assume 0 <= x
static double myfmod(double x) { return x - std::floor(x); }
@trentpolack
trentpolack / UE4EditorViewLocation.cpp
Created July 6, 2018 01:07
Get the actual camera location in the UE4 viewport? MAYBE?
auto world = GetWorld();
if(world == nullptr)
return;
auto viewLocations = world->ViewLocationsRenderedLastFrame;
if(viewLocations.Num() == 0)
return;
FVector camLocation = viewLocations[0];
@trentpolack
trentpolack / Fun With Macros.md
Last active July 18, 2019 19:13
Old-School #pragma Messages to Yourself

The Ol' #pragma Message

For particularly necessary to-do reminders, the JM_TODO macro below will print to the build console (and on the warning/error list) as a trivial warning -- so it won't interfere with builds that treat warnings as errrors. Then you can just double-click it and jump to that spot.

jmtodo-in-action

The Code

#define JM_PRAGMA_STRING2(x) #x
#define JM_PRAGMA_STRING(x) JM_PRAGMA_STRING2(x)
@trentpolack
trentpolack / MovementComponent_TrentsHighlights.cpp
Last active December 26, 2022 12:21
The "Fun" to be had (i.e. a big rant) in writing a general-purpose physical movement component (compound colliders representing static and skeletal meshes and more, but still interacting with the world as a physical entity). NOTE: All comments in this gist are by me.
// Comments are left by me, not from the code.
// Because why not have a default set or make the method abstract or, really, anything but this. Luckily no one would ever
// think to use ::GetMaxSpeed as a divisor or anything.
inline float UMovementComponent::GetMaxSpeed() const
{
return 0.f;
}
// FUN FACT: UMovementComponent defines a plethora of methods for managing the maximum speed of a component. It does not,
@trentpolack
trentpolack / AccessorMacroGenerators.h
Last active January 26, 2018 19:48
Unreal Engine 4 -- Member Accessor Method Macros (NOTE: This does not result in the accessors being available for blueprint-use as they're not UFUNCTIONs).
// NOTE: This does not result in the accessors being available for blueprint-use as they're not UFUNCTIONs.
UCLASS( )
class URawr : public UObject
{
GENERATED_CLASS( )
protected:
float RawrValue;
@trentpolack
trentpolack / EnumerationType.h
Last active June 7, 2021 18:30
Enumerations in Unreal Engine 4
// Generally, developers in UE4 tend towards the following convention for enumerations:
UENUM( BlueprintType )
enum class ENoiseGeneratorCellularType : uint8
{
NGCT_Natural UMETA( DisplayName = "Natural" ),
NGCT_Euclidean UMETA( DisplayName = "Euclidean" ),
NGCT_Manhattan UMETA( DisplayName = "Manhattan" ),
NGCT_Max UMETA( Hidden )
};
@trentpolack
trentpolack / InitializerSharedPtr.cpp
Last active November 11, 2017 07:55
Construction/Allocation-Time std::shared_ptr Initialization (for the case where your class doesn't have constructors with an empty argument list)
class InitializerSharedPtr
{
protected:
struct PrivateStruct
{
explicit PrivateStruct( int Irrelevant )
{ }
};
public:

#Quixel Megascans Scripting Reference ###Updated: Aug 19th, 2016

The Megascans Bridge allows the user to send assets from the Bridge to external applications. The Bridge currently supports the following tools:

  • 3DS Max
  • Marmoset Toolbag 2
  • Unity 3d
  • Unreal Engine 4

#Quixel Megascans Bridge API ####Updated: Aug 19th, 2016

We have developed an API to fetch information from the Bridge. The following is an initial list of endpoints any software will be able to retrieve information from.

  • Megascans repository path
  • Zip folder paths
  • Get all assets (folder and json path)
  • Get selected assets (folder and json path)
  • Search results (folder and json path) against a string