Skip to content

Instantly share code, notes, and snippets.

@victorholt
victorholt / CMakeList.txt
Created April 4, 2015 02:29
CMakeList Example
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
# Above line indicates to Cmake that minimum version 2.8 is required.
# As you may have noted all lines beginning with hash symbol are treated as comments by Cmake.
SET(sampleName MyApp)
# In the above line we declared a variable sampleName and assigned it a value MyApp. We will make use of the same later.project(PrjMyApp)
# here we define the project or solution (for visual studio) name
# In following lines we try to find out the packages of additional libraries, if reqd. Here we are trying to locate PCL and mrpt library.
# u may replace the names by yours. Each such package should have a Cmake file in them, if not then we may have to manually define the paths.
# we Show that later.
@victorholt
victorholt / CurvedText3D.h
Created May 31, 2016 23:10
CurvedText3D.h
#pragma once
#include <Urho3D/Graphics/Drawable.h>
#include <Urho3D/Graphics/VertexBuffer.h>
#include <Urho3D/Math/Matrix3x4.h>
#include <Urho3D/UI/Text.h>
#include <Urho3D/UI/Text3D.h>
#include "../../Utils/LineTool.h"
using namespace CorFramework;
@victorholt
victorholt / CurvedText3D.cpp
Created May 31, 2016 23:10
CurvedText3D.cpp
#include "../PreCompiledHeaders.h"
#include "CurvedText3D.h"
using namespace CorFramework;
namespace Urho3D
{
extern const char* horizontalAlignments[];
extern const char* verticalAlignments[];
extern const char* textEffects[];
@victorholt
victorholt / store_function_example.cpp
Created August 23, 2016 15:34
Store C++ Functions inside of a Class
/************************************
* Example of storing functions inside
* of a class.
*
* Tested with C++14
************************************/
#include <iostream>
#include <vector>
#include <functional>
@victorholt
victorholt / GenericForEach.cpp
Last active April 25, 2017 00:36
GenericForEach
#include <iostream>
#include <string>
#include <functional>
#include <vector>
using namespace std;
#define StringArray std::vector<std::string>
#define ForEachMethod(a) std::function<void(const a&)>
#define ForEachTemplate(a, b) template<class a, class b>
#define ForEachString forEach<StringArray, string>
@victorholt
victorholt / FoliageComponent.h
Created May 2, 2017 14:22
FoliageComponent Header
//
// Created by Victor Holt on 5/1/2017.
//
#pragma once
#include <gs-common/PreCompiledHeadersUrho.h>
#include <gs-common/helpers/SimplePerlin.h>
#include <gs-common/helpers/Array2D.h>
#include <gs-graphics/CustomMesh.h>
using namespace Urho3D;
gs_nsstart
@victorholt
victorholt / FoliageComponent.cpp
Created May 2, 2017 14:23
FoliageComponent Source
//
// Created by Victor Holt on 5/1/2017.
//
#include <cor-game/components/FoliageComponent.h>
#include <cor-game/GameEngine.h>
#include <cor-game/terrain/Grid.h>
#include <cor-game/terrain/GridCell.h>
#include <gs-common/helpers/NumberHelper.hpp>
#include <gs-common/helpers/MathHelper.h>
#include <gs-common/core/SenchaThreadManager.h>
@victorholt
victorholt / urho3d_image_lodenode.cpp
Last active June 19, 2017 14:46
LodeNode Image Loading for Terrain
// Storage for our 16bit pixel.
union uimage_data
{
uint16_t s;
uint8_t b[2];
};
Image* LoadHeightmap(const String& heightmapFilePath)
{
std::vector<unsigned char> pngData;
@victorholt
victorholt / CustomMesh.h
Last active June 27, 2017 03:36
CustomMesh Header Refactored
//
// Created by Victor Holt on 3/18/2017.
// Reference: (rbnpontes) http://discourse.urho3d.io/t/a-mesh-generator/2361
//
#pragma once
#include <gs-common/PreCompiledHeadersUrho.h>
using namespace Urho3D;
namespace Sencha
{
@victorholt
victorholt / CustomMesh.cpp
Last active June 27, 2017 03:50
CustomMesh Src Refactored
//
// Created by Victor Holt on 3/18/2017.
//
#include <gs-graphics/CustomMesh.h>
using namespace Urho3D;
using namespace Sencha;
//! Constructor.
//! \param context
//! \param isDynamic