Skip to content

Commit 7d7a071

Browse files
committed
compile with current CUDA on Windows
1 parent 4f235d9 commit 7d7a071

15 files changed

Lines changed: 549 additions & 216 deletions

File tree

README-Building-deps.txt

Lines changed: 115 additions & 112 deletions
Large diffs are not rendered by default.

cmake/CoviseHelperMacros.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ MACRO(COVISE_FIND_CUDA)
11541154
check_language(CUDA)
11551155
covise_find_package(CUDAToolkit)
11561156
ENDIF(COVISE_USE_CUDA)
1157-
IF(CMAKE_CUDA_COMPILER AND CUDAToolkit_FOUND AND COVISE_USE_CUDA)
1157+
IF((CMAKE_CUDA_COMPILER OR CUDAToolkit_NVCC_EXECUTABLE) AND CUDAToolkit_FOUND AND COVISE_USE_CUDA)
11581158
enable_language(CUDA)
11591159
ADD_DEFINITIONS(-DHAVE_CUDA)
11601160
set(CUDA_FOUND TRUE)
@@ -1165,6 +1165,8 @@ MACRO(COVISE_FIND_CUDA)
11651165
endif()
11661166
endif()
11671167
covise_find_package(CCCL CONFIG)
1168+
MESSAGE("COVISE_USE_CUDA")
1169+
MESSAGE(${COVISE_USE_CUDA})
11681170
ENDIF()
11691171

11701172
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
<skySphere>
2-
<uniform name="tex1" type="sampler2D" value="0"/>
3-
<uniform max="1.0" min="0.5" name="top" type="float" value="0.5"/>
4-
<uniform max="0.0" min="0.5" name="bottom" type="float" value="0.48"/>
5-
<uniform name="floorColor" type="vec4" value="0.0 0.0 0.0 1.0"/>
6-
<vertexProgram>
7-
void main(void)
1+
<_skySphere><uniform name="tex1" type="sampler2D" value="0"/><uniform max="1.0" min="0.5" name="top" type="float" value="0.5"/><uniform max="0.0" min="0.5" name="bottom" type="float" value="0"/><uniform name="floorColor" type="vec4" value="0.0 0.0 0.0 1.0"/><vertexProgram>void main(void)
82
{
93
gl_TexCoord[0] = gl_MultiTexCoord0;
104
gl_Position = ftransform();
115
gl_ClipVertex = gl_ModelViewMatrix*gl_Vertex;
126
}
13-
</vertexProgram>
14-
<fragmentProgram>
15-
uniform sampler2D tex1;
7+
</vertexProgram><fragmentProgram>uniform sampler2D tex1;
168
uniform float top;
179
uniform float bottom;
1810
uniform vec4 floorColor;
@@ -24,6 +16,7 @@ float rand(vec2 co){
2416
void main (void)
2517
{
2618
vec2 texcoord = gl_TexCoord[0].xy;
19+
texcoord.x *= -1;
2720
vec4 texColor = texture2D(tex1, texcoord);
2821
/*vec4 floorColor =
2922
texture2D(tex1, vec2(0.0, 0.0)) +
@@ -39,5 +32,4 @@ void main (void)
3932
mix(floorColor * 0.5, floorColor, smoothstep(0.0, 0.44, texcoord.y + rand(texcoord)*0.01)),
4033
texColor, smoothstep(bottom, top, texcoord.y));
4134
}
42-
</fragmentProgram>
43-
</skySphere>
35+
</fragmentProgram></_skySphere>

src/OpenCOVER/cover/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ if(COVISE_USE_QT)
288288
SET(ALL_SOURCES ${ALL_SOURCES} ${FB_SOURCES})
289289
endif()
290290

291-
ADD_COVISE_LIBRARY(${COVERKERNEL_TARGET} SHARED ${ALL_SOURCES} ${MOCS})
291+
ADD_COVISE_LIBRARY(${COVERKERNEL_TARGET} SHARED ${ALL_HEADERS} ${ALL_SOURCES} ${MOCS})
292292
target_include_directories(${COVERKERNEL_TARGET} PUBLIC ${PTHREAD_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR} ${OPENSCENEGRAPH_INCLUDE_DIRS})
293293

294294
COVISE_USE_OPENMP(${COVERKERNEL_TARGET})

src/OpenCOVER/cover/TeleportNavigationProvider.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <OpenVRUI/coNavInteraction.h>
1313
#include <osg/MatrixTransform>
1414
#include <osg/ref_ptr>
15+
#include <osg/Switch>
1516

1617
#include "coVRNavigationProvider.h"
1718

src/OpenCOVER/plugins/general/GeoData/GeoDataLoader.cpp

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <cover/coVRMSController.h>
2828
#include <cover/coVRConfig.h>
2929
#include <cover/VRViewer.h>
30+
#include <cover/VRSceneGraph.h>
3031
#include <vrml97/vrml/VrmlNamespace.h>
3132
#include <VrmlNodeGeoData.h>
3233

@@ -61,6 +62,10 @@
6162
#include <PluginUtil/PluginMessageTypes.h>
6263
#include <../../../../3rdparty/easyexif/exif.h>
6364
#include <stdio.h>
65+
66+
using namespace vrui;
67+
using namespace opencover;
68+
6469
namespace opencover
6570
{
6671
namespace ui
@@ -747,6 +752,45 @@ bool GeoDataLoader::init()
747752

748753
if (!geo->displayName.empty())
749754
location->setText(geo->displayName); });
755+
756+
757+
editGroup = new ui::Group(geoDataMenu, "edit");
758+
editGroup->setText("Edit");
759+
editGroup->allowRelayout(true);
760+
editInteraction = new editTerrain(this);
761+
762+
editButton = new ui::Button(editGroup, "editTerrain");
763+
editButton->setText("editTerrain");
764+
editButton->setState(false);
765+
editButton->setCallback([this](bool state)
766+
{
767+
if (state)
768+
{
769+
editInteraction->enableIntersection();
770+
}
771+
else
772+
{
773+
editInteraction->disableIntersection();
774+
} });
775+
776+
deleteSelected = new ui::Action(editGroup, "deleteSelected");
777+
deleteSelected->setText("delete");
778+
deleteSelected->setCallback([this]()
779+
{ doDelete(); });
780+
781+
replace = new ui::Action(editGroup, "replace");
782+
replace->setText("replace");
783+
replace->setCallback([this]()
784+
{ doReplace(); });
785+
786+
undo = new ui::Action(editGroup, "undo");
787+
undo->setText("undo");
788+
undo->setCallback([this]()
789+
{ doUndo(); });
790+
791+
selectionName = new ui::Label(editGroup, "name");
792+
selectionName->setText("nothing is selected");
793+
750794
return true;
751795
}
752796

@@ -895,6 +939,131 @@ bool GeoDataLoader::update()
895939
float farValue = coVRConfig::instance()->farClip();
896940
float scale = ((farValue) / 20000) + 500; // scale the sphere so that it stays a bit closer than the far clipping plane.
897941
skyRootNode->setMatrix(osg::Matrix::scale(scale, scale, scale) * osg::Matrix::rotate(northAngle, osg::Vec3(0, 0, 1)) * osg::Matrix::rotate(cover->getObjectsXform()->getMatrix().getRotate()));
942+
if (editInteraction->isRunning())
943+
{
944+
945+
// get the intersected node
946+
if (cover->getIntersectedNode())
947+
{
948+
// position label with name
949+
//nameLabel_->setPosition(cover->getIntersectionHitPointWorld());
950+
if (cover->getIntersectedNode() != oldIntersectedNode)
951+
{
952+
// get the node name
953+
string nodeName;
954+
// char *labelName = NULL;
955+
956+
// show only node names under objects root
957+
// so check if node is under objects root
958+
osg::Node *currentNode = cover->getIntersectedNode();
959+
while (currentNode != NULL)
960+
{
961+
if (currentNode == cover->getObjectsRoot())
962+
{
963+
if (showGeodeName_)
964+
{
965+
// first look for a node description beginning with _SCGR_
966+
std::vector<std::string> dl = cover->getIntersectedNode()->getDescriptions();
967+
for (size_t i = 0; i < dl.size(); i++)
968+
{
969+
std::string descr = dl[i];
970+
if (descr.find("_SCGR_") != string::npos)
971+
{
972+
nodeName = dl[i];
973+
// fprintf(stderr,"found description %s\n", nodeName.c_str());
974+
break;
975+
}
976+
}
977+
if (nodeName.empty())
978+
{ // if there is no description we take the node name
979+
nodeName = cover->getIntersectedNode()->getName();
980+
// fprintf(stderr,"taking the node name %s\n", nodeName.c_str());
981+
}
982+
}
983+
else // show name of the dcs above
984+
{
985+
osg::Node *parentDcs = cover->getIntersectedNode()->getParent(0);
986+
nodeName = parentDcs->getName();
987+
if (nodeName.empty())
988+
{
989+
// if the dcs has no name it could be a helper node
990+
if ((parentDcs->getNumDescriptions() > 0) && (parentDcs->getDescription(1) == "SELECTIONHELPER"))
991+
{
992+
nodeName = parentDcs->getParent(0)->getName();
993+
}
994+
}
995+
}
996+
break;
997+
}
998+
if (currentNode->getNumParents() > 0)
999+
currentNode = currentNode->getParent(0);
1000+
else
1001+
currentNode = NULL;
1002+
}
1003+
1004+
// show label
1005+
if (!nodeName.empty())
1006+
{
1007+
std::string onam = nodeName;
1008+
// eliminate _SCGR_
1009+
if (nodeName.find("_SCGR_") != string::npos)
1010+
{
1011+
nodeName = nodeName.substr(0, nodeName.rfind("_SCGR_"));
1012+
}
1013+
// eliminate 3D studio max name -faces
1014+
if (nodeName.find("-FACES") != string::npos)
1015+
{
1016+
nodeName = nodeName.substr(0, nodeName.rfind("-FACES"));
1017+
}
1018+
// eliminate 3D studio max name _faces
1019+
if (nodeName.find("_FACES") != string::npos)
1020+
{
1021+
nodeName = nodeName.substr(0, nodeName.rfind("_FACES"));
1022+
}
1023+
// eliminate numbers at the end
1024+
while ((nodeName.length() > 0) && (nodeName[nodeName.length() - 1] >= '0') && (nodeName[nodeName.length() - 1] <= '9'))
1025+
{
1026+
nodeName.erase(nodeName.length() - 1, 1);
1027+
}
1028+
1029+
// replace underlines with blanks
1030+
if (nodeName.length() > 0 && nodeName[nodeName.length() - 1] == '_')
1031+
{
1032+
nodeName.erase(nodeName.length() - 1);
1033+
}
1034+
1035+
// check if we now have an empty string (containing spaces only)
1036+
if (nodeName.length() > 0)
1037+
{
1038+
selectionName->setText(nodeName);
1039+
1040+
// delete []labelName;
1041+
oldIntersectedNode = cover->getIntersectedNode();
1042+
}
1043+
else
1044+
{
1045+
selectionName->setText("-");
1046+
oldIntersectedNode = NULL;
1047+
}
1048+
}
1049+
else
1050+
{
1051+
selectionName->setText("-");
1052+
oldIntersectedNode = NULL;
1053+
}
1054+
}
1055+
else
1056+
{
1057+
selectionName->setText("-");
1058+
oldIntersectedNode = NULL;
1059+
}
1060+
}
1061+
else
1062+
{
1063+
selectionName->setText("-");
1064+
oldIntersectedNode = NULL;
1065+
}
1066+
}
8981067
return false; // don't request that scene be re-rendered
8991068
}
9001069
GeoDataLoader *GeoDataLoader::instance()
@@ -1015,3 +1184,85 @@ for (int layerIt = 0; layerIt < poDS->GetLayerCount(); ++layerIt)
10151184
}
10161185

10171186
COVERPLUGIN(GeoDataLoader)
1187+
1188+
void editTerrain::createGeometry()
1189+
{
1190+
1191+
osg::Sphere *mySphere = new osg::Sphere(osg::Vec3(0, 0, 0), 1.0);
1192+
osg::TessellationHints *hint = new osg::TessellationHints();
1193+
hint->setDetailRatio(0.5);
1194+
osg::ShapeDrawable *mySphereDrawable = new osg::ShapeDrawable(mySphere, hint);
1195+
mySphereDrawable->setColor(osg::Vec4(0.6f, 0.6f, 0.6f, 1.0f));
1196+
geometryNode = new osg::Geode();
1197+
scaleTransform->addChild(geometryNode.get());
1198+
moveTransform->addChild(scaleTransform.get());
1199+
((osg::Geode *)geometryNode.get())->addDrawable(mySphereDrawable);
1200+
geometryNode->setStateSet(VRSceneGraph::instance()->loadDefaultGeostate());
1201+
geometryNode->setNodeMask(geometryNode->getNodeMask() | (Isect::Pick) | (Isect::Intersection));
1202+
}
1203+
1204+
1205+
editTerrain::editTerrain(GeoDataLoader *g)
1206+
: vrui::coCombinedButtonInteraction(vrui::coInteraction::ButtonA, "editTerrain", vrui::coInteraction::InteractionPriority::Medium)
1207+
{
1208+
gdl = g;
1209+
_selectedHl = new osg::StateSet();
1210+
_intersectedHl = new osg::StateSet();
1211+
1212+
if (_standardHL)
1213+
{
1214+
// set default materials
1215+
osg::Material *selMaterial = new osg::Material();
1216+
selMaterial->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(1.0, 0.3, 0.0, 1.0f));
1217+
selMaterial->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(1.0, 0.3, 0.0, 1.0f));
1218+
selMaterial->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.1f, 0.1f, 0.1f, 1.0f));
1219+
selMaterial->setShininess(osg::Material::FRONT_AND_BACK, 10.f);
1220+
selMaterial->setColorMode(osg::Material::OFF);
1221+
osg::Material *isectMaterial = new osg::Material();
1222+
isectMaterial->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.6, 0.6, 0.0, 1.0f));
1223+
isectMaterial->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.6, 0.6, 0.0, 1.0f));
1224+
isectMaterial->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.1f, 0.1f, 0.1f, 1.0f));
1225+
isectMaterial->setShininess(osg::Material::FRONT_AND_BACK, 10.f);
1226+
isectMaterial->setColorMode(osg::Material::OFF);
1227+
_selectedHl->setAttribute(selMaterial, osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED);
1228+
_intersectedHl->setAttribute(isectMaterial, osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED);
1229+
}
1230+
1231+
_selectedHl->setAttributeAndModes(polymode, osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED | osg::StateAttribute::ON);
1232+
_selectedHl->setAttributeAndModes(polymode, osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED | osg::StateAttribute::ON);
1233+
}
1234+
1235+
void editTerrain::enableIntersection()
1236+
{
1237+
if (cover->debugLevel(4))
1238+
fprintf(stderr, "coVRIntersectionInteractor(%s)::enableIntersection\n", _interactorName);
1239+
1240+
coInteractionManager::the()->registerInteraction(this);
1241+
}
1242+
1243+
void editTerrain::disableIntersection()
1244+
{
1245+
if (cover->debugLevel(2))
1246+
fprintf(stderr, "coVRIntersectionInteractor(%s)::disableIntersection\n", _interactorName);
1247+
1248+
// interactor is normally unregistered in miss
1249+
// if we disable intersection miss is not called anymore
1250+
// therefore we make sure that the interactor is unregistered
1251+
if (registered)
1252+
{
1253+
coInteractionManager::the()->unregisterInteraction(this);
1254+
}
1255+
1256+
resetState();
1257+
}
1258+
1259+
void GeoDataLoader::doDelete()
1260+
{
1261+
}
1262+
void GeoDataLoader::doReplace()
1263+
{
1264+
}
1265+
void GeoDataLoader::doUndo()
1266+
{
1267+
}
1268+

0 commit comments

Comments
 (0)