34 CVifSCDmaPacket& packet = glContext.GetVif1Packet();
38 AddVu1RendererContext(packet, primType, kContextStart);
43 packet.Base(kDoubleBufBase);
44 packet.Offset(kDoubleBufOffset);
53 bool doLighting = lighting.GetLightingEnabled();
55 float maxColorValue = GetMaxColorValue(XferTexCoords);
58 globalAmb = lighting.GetGlobalAmbient() * maxColorValue;
60 globalAmb.set(0, 0, 0, 0);
62 CImmMaterial& material = glContext.GetMaterialManager().GetImmMaterial();
63 cpu_vec_4 materialAmb = material.GetAmbient();
65 cpu_vec_4 materialEmm;
67 materialEmm = material.GetEmission() * maxColorValue;
69 materialEmm = glContext.GetMaterialManager().GetCurColor() * maxColorValue;
71 ConstantVertColor = materialAmb * globalAmb + materialEmm;
106 CVifSCDmaPacket& packet = pGLContext->GetVif1Packet();
108 int wordsPerVert = block.GetWordsPerVertex();
109 int wordsPerNormal = (block.GetNormalsAreValid()) ? block.GetWordsPerNormal() : 0;
110 int wordsPerTex = (block.GetTexCoordsAreValid()) ? block.GetWordsPerTexCoord() : 0;
111 int wordsPerColor = (block.GetColorsAreValid()) ? block.GetWordsPerColor() : 0;
113 InitXferBlock(packet, wordsPerVert, wordsPerNormal, wordsPerTex, wordsPerColor);
115 for (
int curArray = 0; curArray < block.GetNumArrays(); curArray++) {
117 const void *normals, *vertices, *texCoords, *colors;
118 vertices = block.GetVerticesAreValid() ? block.GetVertices(curArray) : NULL;
119 normals = block.GetNormalsAreValid() ? block.GetNormals(curArray) : NULL;
120 texCoords = block.GetTexCoordsAreValid() ? block.GetTexCoords(curArray) : NULL;
121 colors = block.GetColorsAreValid() ? block.GetColors(curArray) : NULL;
124 packet.Stcycl(1, 3).Nop();
127 int numIndices = block.GetNumIndices(curArray);
128 const void* indices = block.GetIndices(curArray);
129 int numVertices = block.GetArrayLength(curArray);
132 vertices, normals, texCoords, colors,
140 packet.Stmod(Vifs::AddModes::kOffset);
142 Vifs::tMask mask = { 3, 3, 3, 0,
147 static const float row[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
153 int numIndexQwords = numIndices / 16 + (numIndices % 16 > 0);
154 packet.Ref(Core::MakePtrNormal((
const unsigned int*)indices), numIndexQwords);
157 packet.OpenUnpack(Vifs::UnpackModes::s_16, kInputGeomStart,
158 Packet::kDoubleBuff, Packet::kMasked);
160 packet.CloseUnpack(numIndexQwords * 8);
169 packet.Stmod(Vifs::AddModes::kNone);
170 packet.OpenUnpack(Vifs::UnpackModes::v4_32, 0, Packet::kDoubleBuff);
172 packet += numVertices;
173 packet += numIndices / 2 + (numIndices & 1);
174 packet += numIndices;
177 packet.CloseUnpack();
181 packet.Strow(&ConstantVertColor);
182 packet.Stcycl(numVertices, 0);
183 Vifs::tMask mask = { 1, 1, 1, 3,
188 packet.OpenUnpack(Vifs::UnpackModes::v4_32, kTempAreaStart,
189 Packet::kDoubleBuff, Packet::kMasked);
190 packet.CloseUnpack(numVertices);