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
Shader "Hidden/ColoredNoise" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_NoiseTex ("Noise (RGB)", 2D) = "white" {} | |
} | |
CGINCLUDE | |
#include "UnityCG.cginc" |
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
Shader "Bumped Specular" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1) | |
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125 | |
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} | |
_BumpMap ("Normalmap", 2D) = "bump" {} | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } |
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
void Light::SetLightKeyword() | |
{ | |
// OK, "2 at 1" | |
printf_console ("LightMasks: %x at 1\n", (UInt32)(kLightKeywordMasks[1]&0xFFFFFFFF)); | |
// BAD, 0 | |
printf_console ("LightMasks: %x at m_KeywordMode (%i)\n", (UInt32)(kLightKeywordMasks[m_KeywordMode]&0xFFFFFFFF), m_KeywordMode); | |
// BAD, 0 | |
printf_console ("LightMasks: %x at (int)m_KeywordMode (%i)\n", (UInt32)(kLightKeywordMasks[(int)m_KeywordMode]&0xFFFFFFFF), m_KeywordMode); | |
int idx = m_KeywordMode; | |
// BAD, 0 |
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
var myFloat = 1337.0; | |
var myColor = Color (1,0.5,0.3,1); | |
var myTextureRef : Texture; |
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
vbPtr[ 0].vert.Set( x0, y0, 0.0f ); vbPtr[ 0].color = color; vbPtr[ 0].uv.Set( tx0, ty0 ); | |
vbPtr[ 1].vert.Set( x1, y0, 0.0f ); vbPtr[ 1].color = color; vbPtr[ 1].uv.Set( tx1, ty0 ); | |
vbPtr[ 2].vert.Set( x2, y0, 0.0f ); vbPtr[ 2].color = color; vbPtr[ 2].uv.Set( tx2, ty0 ); | |
vbPtr[ 3].vert.Set( x3, y0, 0.0f ); vbPtr[ 3].color = color; vbPtr[ 3].uv.Set( tx3, ty0 ); | |
vbPtr[ 4].vert.Set( x0, y1, 0.0f ); vbPtr[ 4].color = color; vbPtr[ 4].uv.Set( tx0, ty1 ); | |
vbPtr[ 5].vert.Set( x1, y1, 0.0f ); vbPtr[ 5].color = color; vbPtr[ 5].uv.Set( tx1, ty1 ); | |
vbPtr[ 6].vert.Set( x2, y1, 0.0f ); vbPtr[ 6].color = color; vbPtr[ 6].uv.Set( tx2, ty1 ); | |
vbPtr[ 7].vert.Set( x3, y1, 0.0f ); vbPtr[ 7].color = color; vbPtr[ 7].uv.Set( tx3, ty1 ); | |
vbPtr[ 8].vert.Set( x0, y2, 0.0f ); vbPtr[ 8].color = color; vbPtr[ 8].uv.Set( tx0, ty2 ); | |
vbPtr[ 9].vert.Set( x1, y2, 0.0f ); vbPtr[ 9].color = color; vbPtr[ 9].uv.Set( tx1, ty2 ); |
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 public void SetRenderActiveFlagMode( ref GameObject parent, bool mode ) | |
{ | |
var pr = parent.renderer; // query the component just once! | |
if( pr != null ) | |
{ | |
pr.enabled = mode; | |
} | |
var pt = parent.transform; // query the component just once! | |
int childCount = pt.GetChildCount(); |
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 SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
@ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
@ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
@ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
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
#define HANDLE_LIST(texList, FormatFunc, AtlasFunc) \ | |
do { \ | |
const unsigned count = texList.size(); \ | |
Texture2D** tex = count ? &texList[0] : 0; \ | |
\ | |
TextureFormat format; \ | |
unsigned page, pad; \ | |
TextureFilterMode filter; \ | |
\ | |
FormatFunc(tex, count, &format); \ |
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 ONLY A PORTION OF THE FILE | |
// WILL NOT COMPILE OUT OF THE BOX! | |
void OrthogonalizeTangent (TangentInfo& tangentInfo, Vector3f normalf, Vector4f& outputTangent) | |
{ | |
TangentInfo::Vector3d normal = { normalf.x, normalf.y, normalf.z }; | |
TangentInfo::Vector3d tangent = tangentInfo.tangent; | |
TangentInfo::Vector3d binormal = tangentInfo.binormal; |
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
// ---------------------------------------------------------------------------------- | |
// OpenGL | |
SubProgram "opengl " { | |
Keywords { "DIRECTIONAL" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "SHADOWS_OFF" "VERTEXLIGHT_ON" } | |
Bind "vertex" Vertex | |
Bind "tangent" ATTR14 | |
Bind "normal" Normal | |
Bind "texcoord" TexCoord0 |