154
edits
Changes
→This Week
</pre>
<pre>
D3DXCOLOR* ambient;
D3DXCOLOR* diffuse;
D3DXCOLOR* specular;
FLOAT* power;
</pre>
<pre>
ambient = nullptr;
diffuse = nullptr;
specular = nullptr;
power = nullptr;
</pre>
<pre>
ambient = nullptr;
diffuse = nullptr;
specular = nullptr;
power = nullptr;
</pre>
<pre>
if (ambient)
delete [] ambient;
if (diffuse)
delete [] diffuse;
if (specular)
delete [] specular;
if (power)
delete [] power;
ambient = new D3DXCOLOR[src.nSubsets];
diffuse = new D3DXCOLOR[src.nSubsets];
specular = new D3DXCOLOR[src.nSubsets];
power = new FLOAT[src.nSubsets];
</pre>
<pre>
for (unsigned i = 0; i < nSubsets; i++) {
ambient[i] = src.ambient[i];
diffuse[i] = src.diffuse[i];
specular[i] = src.specular[i];
power[i] = src.power[i];
}
</pre>
<pre>
ambient = new D3DXCOLOR[nSubsets];
diffuse = new D3DXCOLOR[nSubsets];
specular = new D3DXCOLOR[nSubsets];
power = new FLOAT[nSubsets];
</pre>
<pre>
ambient[i].r = matl[i].MatD3D.Diffuse.r * 0.7f;
ambient[i].g = matl[i].MatD3D.Diffuse.g * 0.7f;
ambient[i].b = matl[i].MatD3D.Diffuse.b * 0.7f;
ambient[i].a = matl[i].MatD3D.Diffuse.a;
diffuse[i] = matl[i].MatD3D.Diffuse; // reflected from lights
specular[i] = matl[i].MatD3D.Specular; // shine from lights
power[i] = matl[i].MatD3D.Power; // 0 if it shouldn't be shiny
</pre>
<pre>
uniformVS->SetFloatArray(d3dd, "material.ambient", (FLOAT*)&ambient[i], 4);
uniformVS->SetFloatArray(d3dd, "material.diffuse", (FLOAT*)&diffuse[i], 4);
uniformVS->SetFloatArray(d3dd, "material.specular", (FLOAT*)&specular[i], 4);
uniformVS->SetFloat(d3dd, "material.power", (FLOAT)power[i]);
</pre>
<pre>
if (ambient)
delete [] ambient;
if (diffuse)
delete [] diffuse;
if (specular)
delete [] specular;
if (power)
delete [] power;
</pre>
** Device