MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / RenderTexturedBackground

Method RenderTexturedBackground

Sources/Jazz2/UI/Menu/MainMenu.cpp:874–903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872 }
873
874 void MainMenu::RenderTexturedBackground(RenderQueue& renderQueue)
875 {
876 auto target = _texturedBackgroundPass._target.get();
877 if (target == nullptr) {
878 return;
879 }
880
881 Vector4f horizonColor;
882 switch (_preset) {
883 case Preset::Default: horizonColor = Vector4f(0.098f, 0.35f, 1.0f, 0.0f); break;
884 default: horizonColor = Vector4f(0.0f, 0.0f, 0.06f, 1.0f); break;
885 }
886
887 Vector2i viewSize = _canvasBackground->ViewSize;
888 auto command = &_texturedBackgroundPass._outputRenderCommand;
889
890 auto instanceBlock = command->GetMaterial().UniformBlock(Material::InstanceBlockName);
891 instanceBlock->GetUniform(Material::TexRectUniformName)->SetFloatValue(1.0f, 0.0f, 1.0f, 0.0f);
892 instanceBlock->GetUniform(Material::SpriteSizeUniformName)->SetFloatValue(static_cast<float>(viewSize.X), static_cast<float>(viewSize.Y));
893 instanceBlock->GetUniform(Material::ColorUniformName)->SetFloatVector(Colorf(1.0f, 1.0f, 1.0f, 1.0f).Data());
894
895 command->GetMaterial().Uniform("uViewSize")->SetFloatValue(static_cast<float>(viewSize.X), static_cast<float>(viewSize.Y));
896 command->GetMaterial().Uniform("uShift")->SetFloatVector(_texturedBackgroundPos.Data());
897 command->GetMaterial().Uniform("uHorizonColor")->SetFloatVector(horizonColor.Data());
898
899 command->SetTransformation(Matrix4x4f::Translation(0.0f, 0.0f, 0.0f));
900 command->GetMaterial().SetTexture(*target);
901
902 renderQueue.AddCommand(command);
903 }
904
905 bool MainMenu::RenderLegacyBackground(RenderQueue& renderQueue)
906 {

Callers 1

OnDrawMethod · 0.45

Calls 11

UniformBlockMethod · 0.80
SetFloatValueMethod · 0.80
SetFloatVectorMethod · 0.80
UniformMethod · 0.80
SetTransformationMethod · 0.80
AddCommandMethod · 0.80
ColorfClass · 0.50
getMethod · 0.45
GetUniformMethod · 0.45
DataMethod · 0.45
SetTextureMethod · 0.45

Tested by

no test coverage detected