Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using NAudio.Midi; | |
using System.IO; | |
using System.Linq; | |
public class MidiReader : MonoBehaviour { | |
public MidiFile midi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after appcleaner does his magic, do this | |
sudo rm -rf "/Library/Application Support/Paragon Software/" | |
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist | |
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist | |
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist | |
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist | |
sudo rm -rf /Library/Filesystems/ufsd_NTFS.fs/ | |
sudo rm -rf /Library/PrivilegedHelperTools/com.paragon-software.installer | |
sudo rm -rf /Library/Extensions/ufsd_NTFS.kext/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Uniforms.glsl" | |
#include "Samplers.glsl" | |
#include "Transform.glsl" | |
#include "ScreenPos.glsl" | |
//varying vec2 vTexCoord; | |
varying vec2 vScreenPos2; | |
void VS() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node* planeNode = scene_->CreateChild("Plane"); | |
planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f)); | |
StaticModel* planeObject = planeNode->CreateComponent<StaticModel>(); | |
planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl")); | |
auto mat = cache->GetResource<Material>("Materials/StoneTiled.xml")->Clone(); | |
mat->SetRenderOrder(100); // Lower render order to render first | |
auto tecs = mat->GetTechniques(); | |
for (size_t i = 0; i < tecs.Size(); ++i) | |
{ |
Some code allocates memory when running in the editor and not on the device. This is due to Unity doing some extra error handling so possible error messages can be output in the console. Much of this code is stripped during build. It's therefore important to profile on device, and do it regularly.
Optimizations often makes code more rigid and harder to reason. Don't do it until you really need to.
When profiling, wrap methods or portions of a method in Profiler.BeginSample(string name) and Profiler.EndSample() to make them easier to find in the profiler.
public class SomeClass {
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Initialize */ | |
float curvelength = primintrinsic(1, 'arclength', 0); | |
if( curvelength == 0 ) | |
curvelength = primintrinsic(1, 'measuredperimeter', 0); | |
float dist = @P.z / curvelength + ch('offset'); | |
vector2 uv = set(dist, 0); | |
// PRIMUV_UNITLEN_TO_UNIT = 7 | |
vector2 posuv = primuvconvert(@OpInput2, uv, 0, 7); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static jclass callbacksClass; | |
static jobject callbacksInstance; | |
JNIEXPORT void JNICALL Java_com_example_NativeClass_nativeMethod(JNIEnv* env, jclass callingObject, jobject callbacks) | |
{ | |
// Cache the Java callbacks instance | |
callbacksInstance = env->NewGlobalRef(callbacks); | |
// Cache the Java callbacks class (in case of interface, this will be the concrete implementation class) | |
jclass objClass = env->GetObjectClass(callbacks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "hemicube.h" | |
#define PACK_HEMICUBES 1 | |
static void get_hemicube_face_normal(int index, Vector3 *forward, Vector3 *left, Vector3 *up) { | |
// Unwrapped hemicube with positive-Z in the middle. | |
switch (index) { | |
case 0: *forward = Vector3(+1, 0, 0); *left = Vector3( 0, 1, 0); break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a simple game state inspired from a good article about managing game states | |
at http://gamedevgeek.com/tutorials/managing-game-states-in-c/ , i tried to adapt it in Urho3d | |
using events rather than loops update on virtual methods that kill performance. | |
*/ | |
gamestateshandler expect a scene already create , you can simply modified as you like, | |
main.cpp{ |
NewerOlder