From 0dab581700d250cc0748062ce98cf4a2be2c141f Mon Sep 17 00:00:00 2001 From: mzernova Date: Wed, 17 Jul 2019 19:05:53 +0300 Subject: [PATCH] 0030799: Draw Harness, ViewerTest - setup uniforms via vshader command vshaderprog command now supports setup custom uniforms --- src/ViewerTest/ViewerTest_OpenGlCommands.cxx | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ViewerTest/ViewerTest_OpenGlCommands.cxx b/src/ViewerTest/ViewerTest_OpenGlCommands.cxx index aae1909938..dc5feb247d 100644 --- a/src/ViewerTest/ViewerTest_OpenGlCommands.cxx +++ b/src/ViewerTest/ViewerTest_OpenGlCommands.cxx @@ -606,13 +606,20 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI, TCollection_AsciiString anArg (theArgVec[anArgIter]); anArg.LowerCase(); Graphic3d_TypeOfShaderObject aShaderTypeArg = Graphic3d_TypeOfShaderObject(-1); - if (anArg == "-list" - || ((anArg == "-update" - || anArg == "-dump" - || anArg == "-debug" - || anArg == "-reload" - || anArg == "-load") - && anArgIter + 1 < theArgNb)) + if (!aProgram.IsNull() + && anArg == "-uniform" + && anArgIter + 2 < theArgNb) + { + TCollection_AsciiString aName = theArgVec[++anArgIter]; + aProgram->PushVariableFloat (aName, float (Draw::Atof (theArgVec[++anArgIter]))); + } + else if (anArg == "-list" + || ((anArg == "-update" + || anArg == "-dump" + || anArg == "-debug" + || anArg == "-reload" + || anArg == "-load") + && anArgIter + 1 < theArgNb)) { Handle(OpenGl_Context) aGlCtx; if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aCtx->CurrentViewer()->Driver())) @@ -895,6 +902,7 @@ void ViewerTest::OpenGlCommands(Draw_Interpretor& theCommands) "\n\t\t: [-off] [-phong] [-aspect {shading|line|point|text}=shading]" "\n\t\t: [-header VersionHeader]" "\n\t\t: [-tessControl TessControlShader -tesseval TessEvaluationShader]" + "\n\t\t: [-uniform Name FloatValue]" "\n\t\t: Assign custom GLSL program to presentation aspects." "\nvshader [-list] [-dump] [-reload] ShaderId" "\n\t\t: -list prints the list of registered GLSL programs" -- 2.20.1