Skip to content

Instantly share code, notes, and snippets.

View DCubix's full-sized avatar
💭
😄

Diego Lopes DCubix

💭
😄
View GitHub Profile
@DCubix
DCubix / Types.h
Last active April 7, 2017 18:05
Vector Implementation for C
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
typedef uint32_t uint;
typedef uint8_t bool;
#define true 1
#define false 0
#include <string>
#include <fstream>
#include <sstream>
#include "core/tgEngine.h"
#include "core/tgLog.h"
#include "core/tgInput.h"
#include "graphics/tgSpriteBatch.h"
if mouse.events[events.LEFTMOUSE] == 1:
hit = P.mOver.hitObject
if hit is not None:
mesh = hit.meshes[0]
for v in range(mesh.getVertexArrayLength()):
vert = mesh.getVertex(0, v)
uv = vert.getUV()
uv[0] += 0.5
vert.setUV(uv)
from bge import types, render, logic
class CustomTechnique(types.KX_RenderTechnique):
def __init__(self):
super(CustomTechnique, self).__init__()
self.normals_shader = types.BL_Shader(...)
def apply(self):
# render all the meshes with a specific shader
import org.lwjgl.BufferUtils;
import java.nio.FloatBuffer;
import static org.lwjgl.opengl.GL11.*;
public class Mat4 {
public static final Mat4 IDENTITY = new Mat4().identity();
private float[][] m;
class Game : public GameWindow {
public:
Game()
: GameWindow(640, 480, "Test Game")
{
}
void OnLoad() override {
GetCurrentScene()->GetSpriteBatch()->SetAmbientColor(Color(0.01f, 0.02f, 0.07f));
@DCubix
DCubix / Ptr.h
Last active December 9, 2016 02:50
Simple Smart Pointer CLass for C++
/*
* The MIT License
*
* Copyright 2016 twisterge.
*
* 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
void SpriteBatch::Render() {
glBindVertexArray(m_vao);
/// 1. Draw normal maps to the buffer
glEnable(GL_DEPTH_TEST);
m_gbuffer->Bind();
glDepthFunc(GL_LESS);
glDepthMask(true);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/*
* File: Collections.h
* Author: twisterge
*
* Created on December 5, 2016, 11:50 PM
*/
#ifndef COLLECTIONS_H
#define COLLECTIONS_H
/*
* The MIT License
*
* Copyright 2016 twisterge.
*
* 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