Skip to content

Instantly share code, notes, and snippets.

View JSandusky's full-sized avatar

Jonathan Sandusky JSandusky

  • Ohio, United States
View GitHub Profile
@JSandusky
JSandusky / ImSequencer.cpp
Created March 28, 2018 02:41
ImSequencer Revisions
#include "ImSequencer.h"
#include "imgui.h"
#include "imgui_internal.h"
#include <vector>
namespace ImSequencer
{
struct ScrollBarInfo
#include <Urho3D/Resource/Image.h>
#include <vector>
#include <set>
#include <windows.h>
#include <shlobj.h>
#include <Urho3D/DebugNew.h>
@JSandusky
JSandusky / Example.cs
Created April 28, 2018 19:52
ImGuiCLI Example
using ImGuiCLI;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace ImGuiCLITest
{
/// <summary>
/// This is the main type for your game.
/// </summary>
@JSandusky
JSandusky / imgui.cpp
Last active July 30, 2018 02:15
ImGui::InputText with caret at end
bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)
{
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems)
return false;
IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys)
IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)
ImGuiContext& g = *GImGui;
@JSandusky
JSandusky / MeshBatch.cs
Created September 8, 2018 02:35
Monogame automatic sorting and instancing of common draws
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using DelveLib;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Delve.Graphics
@JSandusky
JSandusky / DebugRenderer.cs
Created September 10, 2018 06:40
MonoGame DebugRenderer w/ depth + tris
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Graphics
{
@JSandusky
JSandusky / BakeNorm.fx
Created October 1, 2018 06:52
Render normal to texture
#if OPENGL
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#else
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
#endif
matrix WorldViewProjection;
@JSandusky
JSandusky / ParticleEmitter.cpp
Created October 28, 2018 00:56
Particle emission with interpolation
//
// Copyright (c) 2008-2018 the Urho3D project.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@JSandusky
JSandusky / Header.h
Created November 9, 2018 23:43
Marching Triangles
class DebugRenderer;
class Context;
class Geometry;
struct MTFront;
void ImplicitTangentSpace(const Vector3& norm, Vector3& tangent, Vector3& binormal);
/// A vertex on the advancing front.
struct MTVertex
{
@JSandusky
JSandusky / Shake.as
Last active November 11, 2018 19:21
Angelscript camera shake
// Shakes an object using a # of shake intervals
// Intended behavior is to shake to random directions once per interval, optionally returning
// to the original reference direction
class Shake : ScriptObject
{
// internal state
private Vector3 referenceDirection;
private Vector3 shakeTowards;
private Vector3 shakeBase;