summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/opengles30/FixedFunctionStateGLES30.cpp
blob: de052b987793c265ca0c99d5f2b62c66b0f207cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "UnityPrefix.h"
#include "FixedFunctionStateGLES30.h"
#include <sstream>


FixedFunctionStateGLES30::FixedFunctionStateGLES30 ()
:	texUnitCount(0),
	lightType(0),
	texUnitMatrix(0),
	lightingEnabled(false),
	specularEnabled(true),
	onlyDirectionalLights(false),
	lightCount(0),
	useUniformInsteadOfVertexColor(false),
	useVertexColorAsAmbientAndDiffuse(false),
	useVertexColorAsEmission(false),
	fogMode(kFogDisabled),
	addSpecularAfterTexturing(false),
	alphaTest(kFuncDisabled)
{
	for (int q = 0; q < kMaxSupportedTextureUnitsGLES; ++q)
	{
		texUnitCube[q] = false;
		texUnitGen[q] = kTexGenDisabled;
		texUnitColorCombiner[q] = ~0UL;
		texUnitAlphaCombiner[q] = ~0UL;
	}
}

static std::string CombinerToString (unsigned int combinerDesc)
{
	std::ostringstream s;
	s << combinerDesc;
	return s.str().c_str();
}


std::string FixedFunctionStateGLES30::ToString () const
{
	std::ostringstream s;

	s << "FixedFunctionStateGLES30::ToString():\n";
	s << "  lightingEnabled = " << lightingEnabled << "\n";
	s << "  specularEnabled = " << specularEnabled << "\n";
	s << "  lights = " << lightCount << "\n";
	for (int i = 0; i < lightCount; ++i)
		s << "    light" << i << " : " << GetLightType(i) << "\n";

	s << "  useUniformInsteadOfVertexColor = " << useUniformInsteadOfVertexColor << "\n";
	s << "  useVertexColorAsAmbientAndDiffuse = " << useVertexColorAsAmbientAndDiffuse << "\n";
	s << "  useVertexColorAsEmission = " << useVertexColorAsEmission << "\n";

	s << "  fogMode = " << fogMode << "\n";

	for (int i = 0; i < texUnitCount; ++i)
	{
		s << "  texture " << i << "\n";

		s << "    CUBE = " << ((texUnitCube[i])? "true": "false") << "\n";
		s << "    rgb combiner = " << CombinerToString(texUnitColorCombiner[i]) << "\n";
		s << "    alpba combiner = " << CombinerToString(texUnitAlphaCombiner[i]) << "\n";
		s << "    texGen = " << texUnitGen[i] << "\n";
		s << "    need matrix: " << (NeedTexUnitMatrix(i)?"true":"false") << "\n";
		s << "    need perspective divide: " << (IsTexUnitProjected(i)?"true":"false") << "\n";
	}

	s << "  addSpecularafterTexturing = " << addSpecularAfterTexturing << "\n";
	s << "  alphaTest = " << alphaTest << "\n";

	return s.str().c_str();
}