Esempio n. 1
0
bool soso_object::render() {
    
    // Texturing
    //glEnable(GL_TEXTURE_2D);
    glActiveTexture(GL_TEXTURE0);
    baseMap->bind();
    
    glActiveTexture(GL_TEXTURE1);
    if (useDetail) {
        detailMap->bind();
    }
    
    glActiveTexture(GL_TEXTURE2);
    if (useMulti) {
        multipurposeMap->bind();
    }
    
    glActiveTexture(GL_TEXTURE3);
    if (useCube) {
        cubeMap->bind();
    }
    
    // Blending
    //glEnable(GL_BLEND);
    //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    
    // Scales
    glUniform4f(scaleId, uscale, vscale, detailScale, detailScaleV);
    glUniform3f(mapsId , b2f(useMulti), b2f(useDetail), useCube ? 0.5:0.0);
    glUniform2f(reflectionScaleId, reflectionPerpendicular, reflectionParallel);
    return true;
}
Esempio n. 2
0
//compute the central point of each filterbank on mel-scale
//for M filterbanks, the central point shoule be extended to M+2
int* MelCentralPoint(int Fl, int Fh, int M,
                     int Fs, int N)
{
    int m;
    double F;
    int *CentralPoint=new int[M+2];
    for(m=0 ; m<=M+1 ; m++)
    {
        //central frequency  中心频率,高-低加低,乘以m数/点数
        F=b2f(f2b(Fl)+(f2b(Fh)-f2b(Fl))*m/(M+1));
        //central point
        CentralPoint[m]=f2n(F, Fs, N);
    }
    return CentralPoint;
}
Esempio n. 3
0
void printNumDetail(const char *binResult)
{
    char *sign = binResult[0] == '0' ? "+" : "-";
    char exponent[9];
    char mantisa[24];
    memset(exponent, '\0', sizeof(exponent));
    memset(mantisa, '\0', sizeof(mantisa));
    strncpy(exponent, binResult + 1, 8);
    strncpy(mantisa, binResult + 9, 23);
    int expResult = b2dec(exponent);
    float mantisaResult = b2f(mantisa);
    printf(
        "sign: %s\nexponent: %s --> %d [%d - 127 = %d]\nmantisa: %s --> %f\n",
        sign, exponent, (expResult - 127), expResult, expResult - 127,
        mantisa, mantisaResult);
    float floatNum = pow2i(expResult - 127) * mantisaResult;
    floatNum = strcmp(sign, "+") == 0 ? floatNum : floatNum * (-1.0);
    printf("Float Format: %s 2^%d x %f = %d * %f = %f\n", sign, expResult - 127,
           mantisaResult, pow2i(expResult - 127), mantisaResult, floatNum);
}