Skip to content

Instantly share code, notes, and snippets.

@xophiix
xophiix / grayscale
Created June 27, 2013 07:53
gray shader
void main()
{
// Convert to grayscale using NTSC conversion weights
float gray = dot(gl_Color.rgb, vec3(0.299, 0.587, 0.114));
gl_FragColor = vec4(gray, gray, gray, gl_Color.a);
}
@xophiix
xophiix / LamberFlattenDiffuse.glsl
Created May 24, 2013 01:56
LamberFlattenDiffuse model
uniform float shininess;
varying vec3 normal, color, pos;
void main()
{
vec3 l = normalize(gl_LightSource[0].position.xyz - pos);
vec3 n = normalize(nromal);
float nl = max(0.0, (dot(n,l)));
// flatten
//RVA To Offset
DWORD CPEReaderDlg::RVAToOffset(DWORD pMapping,DWORD dwRVA)
{
//Defines
DWORD pNTDst = 0;
IMAGE_DOS_HEADER* pidh = (IMAGE_DOS_HEADER*)pMapping;
pNTDst = pMapping + pidh->e_lfanew;
DWORD pSeDst = pNTDst;
IMAGE_NT_HEADERS* pinh = (IMAGE_NT_HEADERS*)pNTDst;
IMAGE_SECTION_HEADER* pish = NULL;
/* Coefficients for Matrix M */
#define M11   0.0  
#define M12   1.0
#define M13   0.0
#define M14   0.0
#define M21  -0.5
#define M22   0.0
#define M23   0.5
#define M24   0.0
#define M31   1.0
@xophiix
xophiix / getLocationOnGoogleMap
Last active December 14, 2015 18:49
html5 learning and code snippets
<!DOCTYPE html>
<html>
<body>
<p id="demo">点击这个按钮,获得您的位置:</p>
<button onclick="getLocation()">试一下</button>
<div id="mapholder"></div>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var x=document.getElementById("demo");
function getLocation()
;研究了一下 Intel CPU的CPUID指令
;搞了一个晚上~弄出来这个东西~!
;呵呵``没什么技术~别见笑
;附件是完整原文件,和偶收集的一点资料
;编译环境:winxp sp3    RadASM
.586p
.model flat ,stdcall
NULL    equ 0
#include <iostream>
#include <windows.h>
#include <Tlhelp32.h.>
using namespace std;
int main()
{
HANDLE h= CreateToolhelp32Snapshot(8, 780);
MODULEENTRY32 me;
int ret = Module32First(h, &me);