...
 
Commits (2)
......@@ -234,6 +234,11 @@ PYBIND11_EMBEDDED_MODULE(ViewControl, m) {
QCoreApplication::translate("PythonDocViewControl","Enable or disable two sided lighting.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocViewControl","Specifies whether to enable or disable two sided lighting.").toLatin1().data()) );
view.def("project", &ViewControlPlugin::project,
QCoreApplication::translate("PythonDocViewControl","Use the projection matrix of the given viewer to project the point").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocViewControl","Coordinates of a point").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocViewControl","ViewerId").toLatin1().data()) = 0 );
//
// emit setSlotDescription("setObjectDrawMode(QString,int,bool)", "Set the drawMode for an object",
// QString("DrawMode,ObjectID,Force").split(","),
......
......@@ -217,8 +217,8 @@ void ViewControlPlugin::updateShaderList() {
std::vector<QString> uniforms;
if ( ini.get_entry(uniforms,"Info","uniforms") ) {
info.hasUniforms = true;
for ( uint i = 0 ; i < uniforms.size() ; ++i)
info.uniforms << uniforms[i];
for ( uint uniform = 0 ; uniform < uniforms.size() ; ++uniform)
info.uniforms << uniforms[uniform];
} else {
info.hasUniforms = false;
info.uniforms.clear();
......@@ -227,8 +227,8 @@ void ViewControlPlugin::updateShaderList() {
//unform types
uniforms.clear();
if ( info.hasUniforms && ini.get_entry(uniforms,"Info","uniformTypes") ) {
for ( uint i = 0 ; i < uniforms.size() ; ++i)
info.uniformTypes << uniforms[i];
for ( uint uniform = 0 ; uniform < uniforms.size() ; ++uniform)
info.uniformTypes << uniforms[uniform];
} else if ( info.hasUniforms ) {
info.hasUniforms = false;
info.uniforms.clear();
......@@ -239,8 +239,8 @@ void ViewControlPlugin::updateShaderList() {
//uniform default values
uniforms.clear();
if ( info.hasUniforms && ini.get_entry(uniforms,"Info","uniformsDefault" ) ) {
for ( uint i = 0 ; i < uniforms.size() ; ++i)
info.uniformsDefault << uniforms[i];
for ( uint uniform = 0 ; uniform < uniforms.size() ; ++uniform)
info.uniformsDefault << uniforms[uniform];
} else if ( info.hasUniforms ) {
info.hasUniforms = false;
info.uniforms.clear();
......@@ -250,16 +250,16 @@ void ViewControlPlugin::updateShaderList() {
//uniform min values
uniforms.clear();
if ( info.hasUniforms && ini.get_entry(uniforms,"Info","uniformsMin" ) ) {
for ( uint i = 0 ; i < uniforms.size() ; ++i)
info.uniformsMin << uniforms[i];
for ( uint uniform = 0 ; uniform < uniforms.size() ; ++uniform)
info.uniformsMin << uniforms[uniform];
} else if ( info.hasUniforms )
info.uniformsMin = info.uniformsDefault;
//uniform max values
uniforms.clear();
if ( info.hasUniforms && ini.get_entry(uniforms,"Info","uniformsMax" ) ) {
for ( uint i = 0 ; i < uniforms.size() ; ++i)
info.uniformsMax << uniforms[i];
for ( uint uniform = 0 ; uniform < uniforms.size() ; ++uniform)
info.uniformsMax << uniforms[uniform];
} else if ( info.hasUniforms )
info.uniformsMax = info.uniformsDefault;
......@@ -1447,6 +1447,10 @@ void ViewControlPlugin::setTwoSidedLighting(bool _enabled) {
PluginFunctions::viewerProperties().twoSidedLighting(_enabled);
}
ACG::Vec3d ViewControlPlugin::project(ACG::Vec3d _point, int _viewerId) {
ACG::GLState& state = PluginFunctions::viewerProperties(_viewerId).glState();
return state.project(_point);
}
void ViewControlPlugin::setDescriptions() {
emit setSlotDescription("translate(Vector,int)", "Translate Scene",
......
......@@ -352,6 +352,9 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
void setTwoSidedLighting(bool _enabled);
/// Use the projection matrix of the given viewer to project the point
ACG::Vec3d project(ACG::Vec3d _point, int _viewerId = 0);
};