コード例 #1
0
    ret.x = r*cos(theta);
    ret.y = r*sin(theta);
    return ret;
}

vec2 rand_on_unit_circle(inout RNGState rstate)
{
    float theta = rand01(rstate) * radians(360.0);
    vec2 ret;
    ret.x = cos(theta);
    ret.y = sin(theta);
    return ret;
}
''')

vki.Add_Inlcude_Filename('rand_xorwow.shinc')


class RNGInitializer(vki.ShaderViewable):
    def __init__(self):
        xorwow_data = np.fromfile(os.path.dirname(__file__) + '/' +
                                  'xor_wow_data.bin',
                                  dtype=np.uint32)
        self.d_xorwow_data = vki.device_vector_from_numpy(xorwow_data)
        self.m_cptr = SVCombine_Create({'data': self.d_xorwow_data}, '''
void matvec_i(int i, uint v_i, in Comb_#hash# initializer, int offset, inout V5 result)
{
    for (int j = 0; j < 32; j++)
        if ((v_i & (1 << j))!=0)
        {
            int k = (i * 32 + j)*5 + offset;            
コード例 #2
0
ファイル: spectrum.py プロジェクト: fynv/FeiRaysInline
3.240479, -0.969256, 0.055648,
-1.537150, 1.875991, -0.204043,
-0.498535, 0.041556, 1.057311);

vec3 rgb2xyz(in vec3 rgb)
{
    return mat_rgb2xyz * rgb;
}

vec3 xyz2rgb(in vec3 xyz)
{
    return mat_xyz2rgb * xyz;
}
''')

vki.Add_Inlcude_Filename('spectrum.shinc')


class RGBSpectrum(vki.ShaderViewable):
    def __init__(self, color=(0.0, 0.0, 0.0)):
        self.m_rgb = glm.vec3(color)
        self.m_svdata = vki.SVVec3(self.m_rgb)
        self.m_cptr = SVCombine_Create({'data': self.m_svdata}, '''
void incr(inout Comb_#hash# a, in Comb_#hash# b)
{
    a.data += b.data;
}

Comb_#hash# add(in Comb_#hash# a, in Comb_#hash# b)
{
    Comb_#hash# ret;