Hey Guys,
I have some troubles with the function:
which Im using for months to generate pixelshaders cuz they look better than textures..
So my problem is following -> if I want colors which are defined like
its no problem, 1.0f is ment as 255 , means eg for red its like RGBA :
which is equal to the red color code
so my problem is starting in the following:
if I have eg grey as Colorcode its like
and we know that theres a equality between 1.0f and 255
so the shader number for the shader based on 88 should be
because of the equality
so simple equality math like we learned it in school, but the big problem is that its not showing grey then, its showing black, like it would be
for the generator function and not
so its weirdly painting black but its all calculated right, so Im confused now like running against a wall :banghead:
and for geting grey as pixelshader I ofc do
but as I wrote here .... its freaking painting the stuff black =.='
,greez GAFO :thinking:
I have some troubles with the function:
Code:
HRESULT GenerateShader(IDirect3DDevice9* Device, IDirect3DPixelShader9** Shader, float r, float g, float b, float t)
{
char ShaderAsmBuf[256];
ID3DXBuffer* ShaderBuf = NULL;
sprintf_s(ShaderAsmBuf, "ps_3_0\ndef c0, %f, %f, %f, %f\nmov oC0,c0", r, g, b, t);
if (FAILED(D3DXAssembleShader(ShaderAsmBuf, (strlen(ShaderAsmBuf) + 1), NULL, NULL, 0, &ShaderBuf, NULL)))
{
return E_FAIL;
}
return Device->CreatePixelShader((const DWORD*)ShaderBuf->GetBufferPointer(), Shader);
}So my problem is following -> if I want colors which are defined like
Code:
GenerateShader(pDevice, &RedShader, 1.0f, 0.0f, 0.0f, 1.0f);
GenerateShader(pDevice, &GreenShader, 0.0f, 1.0f, 0.0f, 1.0f);
GenerateShader(pDevice, &BlueShader, 0.0f, 0.0f, 1.0f, 1.0f);
GenerateShader(pDevice, &BlackShader, 0.0f, 0.0f, 0.0f, 0.0f);
GenerateShader(pDevice, &YellowShader, 1.0f, 1.0f, 0.0f, 1.0f);
GenerateShader(pDevice, &PinkShader, 1.0f, 0.0f, 1.0f, 1.0f);Code:
1.0f, 0.0f, 0.0f, 1.0fCode:
255, 000, 000, 255if I have eg grey as Colorcode its like
Code:
88, 88, 88, 255so the shader number for the shader based on 88 should be
Code:
88/255 = 0.3450980392156863fCode:
255 = 1.0f
88 = x
x = 88*1.0f/255Code:
1.0f, 0.0f, 1.0f, 1.0fCode:
0.3450980392156863f, 0.3450980392156863f, 0.3450980392156863f, 1.0fand for geting grey as pixelshader I ofc do
Code:
GenerateShader(pDevice, &GreyShader, 0.3450980392156863f, 0.3450980392156863f, 0.3450980392156863f, 1.0f);,greez GAFO :thinking:
Aucun commentaire:
Enregistrer un commentaire