Skip to content

Commit

Permalink
Merge pull request #308 from vsg-dev/Win32_Warning_Fixes
Browse files Browse the repository at this point in the history
Win32 warning fixes
  • Loading branch information
robertosfield authored Apr 29, 2024
2 parents a70caa5 + 59d1fdf commit ba0b537
Show file tree
Hide file tree
Showing 31 changed files with 164 additions and 165 deletions.
25 changes: 13 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,24 @@ endif()
# install data
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ DESTINATION share/vsgExamples)

# pure VSG examples
# VSG examples
add_subdirectory(examples/animation)
add_subdirectory(examples/app)
add_subdirectory(examples/commands)
add_subdirectory(examples/core)
add_subdirectory(examples/maths)
add_subdirectory(examples/io)
add_subdirectory(examples/ui)
add_subdirectory(examples/state)
add_subdirectory(examples/commands)
add_subdirectory(examples/nodes)
add_subdirectory(examples/threading)
add_subdirectory(examples/app)
add_subdirectory(examples/vk)
add_subdirectory(examples/text)
add_subdirectory(examples/lighting)
add_subdirectory(examples/maths)
add_subdirectory(examples/meshshaders)
add_subdirectory(examples/raytracing)
add_subdirectory(examples/nodes)
add_subdirectory(examples/platform)
add_subdirectory(examples/raytracing)
add_subdirectory(examples/state)
add_subdirectory(examples/text)
add_subdirectory(examples/threading)
add_subdirectory(examples/ui)
add_subdirectory(examples/utils)
add_subdirectory(examples/vk)
add_subdirectory(examples/volume)
add_subdirectory(examples/animation)

vsg_add_feature_summary()
16 changes: 8 additions & 8 deletions examples/animation/vsganimation/vsganimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ int main(int argc, char** argv)
{
auto shaderHints = vsg::ShaderCompileSettings::create();

float penumbraRadius = 0.005;
float penumbraRadius = 0.005f;
if (arguments.read("--pcss"))
{
shadowSettings = vsg::PercentageCloserSoftShadows::create(numShadowMapsPerLight);
Expand Down Expand Up @@ -386,9 +386,9 @@ int main(int argc, char** argv)
vsg::StateInfo stateInfo;

double margin = bounds.max.z - bounds.min.z;
geomInfo.position.set((bounds.min.x + bounds.max.x)*0.5, (bounds.min.y + bounds.max.y)*0.5, 0.0);
geomInfo.dx.set(bounds.max.x - bounds.min.x + margin, 0.0, 0.0);
geomInfo.dy.set(0.0, bounds.max.y - bounds.min.y + margin, 0.0);
geomInfo.position.set(static_cast<float>(bounds.min.x + bounds.max.x)*0.5f, static_cast<float>(bounds.min.y + bounds.max.y)*0.5f, 0.0f);
geomInfo.dx.set(static_cast<float>(bounds.max.x - bounds.min.x + margin), 0.0f, 0.0f);
geomInfo.dy.set(0.0, static_cast<float>(bounds.max.y - bounds.min.y + margin), 0.0f);
geomInfo.color.set(1.0f, 1.0f, 1.0f, 1.0f);

stateInfo.two_sided = true;
Expand All @@ -406,17 +406,17 @@ int main(int argc, char** argv)
{
auto directionalLight = vsg::DirectionalLight::create();
directionalLight->name = "directional";
directionalLight->color.set(1.0, 1.0, 1.0);
directionalLight->intensity = 0.9;
directionalLight->color.set(1.0f, 1.0f, 1.0f);
directionalLight->intensity = 0.9f;
directionalLight->direction = direction;
directionalLight->shadowSettings = shadowSettings;

scene->addChild(directionalLight);

auto ambientLight = vsg::AmbientLight::create();
ambientLight->name = "ambient";
ambientLight->color.set(1.0, 1.0, 1.0);
ambientLight->intensity = 0.1;
ambientLight->color.set(1.0f, 1.0f, 1.0f);
ambientLight->intensity = 0.1f;
scene->addChild(ambientLight);
}

Expand Down
6 changes: 3 additions & 3 deletions examples/app/vsganaglyphicstereo/vsganaglyphicstereo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ReplaceColorBlendState : public vsg::Visitor
}
};

vsg::ref_ptr<vsg::Node> createTextureQuad(const vsg::vec3& origin, const vsg::vec3& horizontal, const vsg::vec3& vertical, vsg::ref_ptr<vsg::Data> imageData, uint32_t mipmapLevelsHints = 0)
vsg::ref_ptr<vsg::Node> createTextureQuad(const vsg::vec3& origin, const vsg::vec3& horizontal, const vsg::vec3& vertical, vsg::ref_ptr<vsg::Data> imageData, float mipmapLevelsHints = 0.0f)
{

// set up search paths to SPIRV shaders and textures
Expand Down Expand Up @@ -240,8 +240,8 @@ int main(int argc, char** argv)
if (leftImage && rightImage)
{
vsg::vec3 origin(0.0f, 0.0f, 0.0f);
vsg::vec3 horizontal(leftImage->width(), 0.0f, 0.0f);
vsg::vec3 vertical(0.0f, 0.0f, leftImage->height());
vsg::vec3 horizontal(static_cast<float>(leftImage->width()), 0.0f, 0.0f);
vsg::vec3 vertical(0.0f, 0.0f, static_cast<float>(leftImage->height()));

auto leftQuad = createTextureQuad(origin - offset * 0.5f, horizontal, vertical, leftImage);
auto rightQuad = createTextureQuad(origin + offset * 0.5f, horizontal, vertical, rightImage);
Expand Down
2 changes: 1 addition & 1 deletion examples/app/vsgcameras/vsgcameras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ int main(int argc, char** argv)

// set up secondary views, one per camera found in the scene graph
uint32_t margin = 10;
uint32_t division = scene_cameras.size();
uint32_t division = static_cast<uint32_t>(scene_cameras.size());
if (division<3) division = 3;

uint32_t secondary_width = width / division;
Expand Down
7 changes: 0 additions & 7 deletions examples/io/vsgcluster/vsgcluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ int main(int argc, char** argv)

viewer->compile();

std::vector<uint64_t> buffer(1);
uint32_t buffer_size = buffer.size() * sizeof(decltype(buffer)::value_type);

std::cout << "buffer_size = " << buffer_size << std::endl;

PacketBroadcaster broadcaster;
broadcaster.broadcaster = bc;

Expand All @@ -235,8 +230,6 @@ int main(int argc, char** argv)

if (rc)
{
//unsigned int size = rc->receive(buffer.data(), buffer_size);
//std::cout << "received size = " << size << std::endl;
auto object = receiver.receive();
viewerData = object.cast<cluster::ViewerData>();
if (viewerData)
Expand Down
2 changes: 2 additions & 0 deletions examples/lighting/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(vsglights)
add_subdirectory(vsgshadow)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ vsg::ref_ptr<vsg::Node> createTestScene(vsg::ref_ptr<vsg::Options> options)

auto bounds = vsg::visit<vsg::ComputeBounds>(scene).bounds;
double diameter = vsg::length(bounds.max - bounds.min);
geomInfo.position.set((bounds.min.x + bounds.max.x)*0.5, (bounds.min.y + bounds.max.y)*0.5, bounds.min.z);
geomInfo.dx.set(diameter, 0.0, 0.0);
geomInfo.dy.set(0.0, diameter, 0.0);
geomInfo.position.set(static_cast<float>((bounds.min.x + bounds.max.x)*0.5), static_cast<float>((bounds.min.y + bounds.max.y)*0.5), static_cast<float>(bounds.min.z));
geomInfo.dx.set(static_cast<float>(diameter), 0.0f, 0.0f);
geomInfo.dy.set(0.0f, static_cast<float>(diameter), 0.0f);

scene->addChild(builder->createQuad(geomInfo, stateInfo));

Expand Down Expand Up @@ -127,8 +127,8 @@ int main(int argc, char** argv)
{
auto ambientLight = vsg::AmbientLight::create();
ambientLight->name = "ambient";
ambientLight->color.set(1.0, 1.0, 1.0);
ambientLight->intensity = 0.01;
ambientLight->color.set(1.0f, 1.0f, 1.0f);
ambientLight->intensity = 0.01f;
group->addChild(ambientLight);
}

Expand All @@ -137,9 +137,9 @@ int main(int argc, char** argv)
{
auto directionalLight = vsg::DirectionalLight::create();
directionalLight->name = "directional";
directionalLight->color.set(1.0, 1.0, 1.0);
directionalLight->intensity = 0.15;
directionalLight->direction.set(0.0, -1.0, -1.0);
directionalLight->color.set(1.0f, 1.0f, 1.0f);
directionalLight->intensity = 0.15f;
directionalLight->direction.set(0.0f, -1.0f, -1.0f);
group->addChild(directionalLight);
}

Expand All @@ -148,9 +148,9 @@ int main(int argc, char** argv)
{
auto pointLight = vsg::PointLight::create();
pointLight->name = "point";
pointLight->color.set(1.0, 1.0, 0.0);
pointLight->intensity = span*0.5;
pointLight->position.set(bounds.min.x, bounds.min.y, bounds.max.z + span*0.3);
pointLight->color.set(1.0f, 1.0f, 0.0);
pointLight->intensity = static_cast<float>(span*0.5);
pointLight->position.set(static_cast<float>(bounds.min.x), static_cast<float>(bounds.min.y), static_cast<float>(bounds.max.z + span*0.3));

// enable culling of the point light by decorating with a CullGroup
auto cullGroup = vsg::CullGroup::create();
Expand All @@ -167,12 +167,12 @@ int main(int argc, char** argv)
{
auto spotLight = vsg::SpotLight::create();
spotLight->name = "spot";
spotLight->color.set(0.0, 1.0, 1.0);
spotLight->intensity = span*0.5;
spotLight->position.set(bounds.max.x + span*0.1, bounds.min.y - span*0.1, bounds.max.z + span*0.3);
spotLight->color.set(0.0f, 1.0f, 1.0f);
spotLight->intensity = static_cast<float>(span*0.5);
spotLight->position.set(static_cast<float>(bounds.max.x + span*0.1), static_cast<float>(bounds.min.y - span*0.1), static_cast<float>(bounds.max.z + span*0.3));
spotLight->direction = (bounds.min+bounds.max)*0.5 - spotLight->position;
spotLight->innerAngle = vsg::radians(8.0);
spotLight->outerAngle = vsg::radians(9.0);
spotLight->innerAngle = vsg::radians(8.0f);
spotLight->outerAngle = vsg::radians(9.0f);

// enable culling of the spot light by decorating with a CullGroup
auto cullGroup = vsg::CullGroup::create();
Expand All @@ -188,14 +188,14 @@ int main(int argc, char** argv)
{
auto ambientLight = vsg::AmbientLight::create();
ambientLight->name = "ambient";
ambientLight->color.set(1.0, 1.0, 1.0);
ambientLight->intensity = 0.1;
ambientLight->color.set(1.0f, 1.0f, 1.0f);
ambientLight->intensity = 0.1f;

auto directionalLight = vsg::DirectionalLight::create();
directionalLight->name = "head light";
directionalLight->color.set(1.0, 1.0, 1.0);
directionalLight->intensity = 0.9;
directionalLight->direction.set(0.0, 0.0, -1.0);
directionalLight->color.set(1.0f, 1.0f, 1.0f);
directionalLight->intensity = 0.9f;
directionalLight->direction.set(0.0f, 0.0f, -1.0f);

auto absoluteTransform = vsg::AbsoluteTransform::create();
absoluteTransform->addChild(ambientLight);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vsg::ref_ptr<vsg::Node> decorateIfRequired(vsg::ref_ptr<vsg::Node> node, const M
{
auto bb = vsg::visit<vsg::ComputeBounds>(node).bounds;
auto lod = vsg::LOD::create();
lod->bound = vsg::sphere((bb.min + bb.max) * 0.5, vsg::length(bb.max - bb.min));
lod->bound = vsg::dsphere((bb.min + bb.max) * 0.5, vsg::length(bb.max - bb.min));
lod->addChild(vsg::LOD::Child{settings.lodScreenRatio, node});
return lod;
}
Expand Down Expand Up @@ -79,10 +79,10 @@ vsg::ref_ptr<vsg::Node> createTestScene(const ModelSettings& settings)
auto bounds = vsg::visit<vsg::ComputeBounds>(scene).bounds;
if (settings.insertBaseGeometry)
{
double diameter = vsg::length(bounds.max - bounds.min);
geomInfo.position.set((bounds.min.x + bounds.max.x)*0.5, (bounds.min.y + bounds.max.y)*0.5, bounds.min.z);
geomInfo.dx.set(diameter, 0.0, 0.0);
geomInfo.dy.set(0.0, diameter, 0.0);
float diameter = static_cast<float>(vsg::length(bounds.max - bounds.min));
geomInfo.position.set(static_cast<float>((bounds.min.x + bounds.max.x)*0.5), static_cast<float>((bounds.min.y + bounds.max.y)*0.5), static_cast<float>(bounds.min.z));
geomInfo.dx.set(diameter, 0.0f, 0.0f);
geomInfo.dy.set(0.0f, diameter, 0.0f);
geomInfo.color.set(1.0f, 1.0f, 1.0f, 1.0f);

stateInfo.two_sided = true;
Expand Down Expand Up @@ -158,11 +158,11 @@ vsg::ref_ptr<vsg::Node> createLargeTestScene(const ModelSettings& settings)

if (settings.insertBaseGeometry)
{
double diameter = vsg::length(bounds.max - bounds.min);
geomInfo.position.set((bounds.min.x + bounds.max.x)*0.5, (bounds.min.y + bounds.max.y)*0.5, bounds.min.z);
geomInfo.dx.set(diameter, 0.0, 0.0);
geomInfo.dy.set(0.0, diameter, 0.0);
geomInfo.dz.set(0.0, 0.0, 1.0);
float diameter = static_cast<float>(vsg::length(bounds.max - bounds.min));
geomInfo.position.set(static_cast<float>((bounds.min.x + bounds.max.x)*0.5), static_cast<float>((bounds.min.y + bounds.max.y)*0.5), static_cast<float>(bounds.min.z));
geomInfo.dx.set(diameter, 0.0f, 0.0f);
geomInfo.dy.set(0.0f, diameter, 0.0f);
geomInfo.dz.set(0.0f, 0.0f, 1.0f);
geomInfo.color.set(1.0f, 1.0f, 1.0f, 1.0f);

stateInfo.two_sided = true;
Expand Down Expand Up @@ -426,8 +426,8 @@ int main(int argc, char** argv)

auto inherit = arguments.read("--inherit");
auto direction = arguments.value(vsg::dvec3(0.0, 0.0, -1.0), "--direction");
auto angleSubtended = arguments.value<double>(0.0090f, "--angleSubtended");
auto location = arguments.value<vsg::dvec3>({0.0, 0.0, 0.0}, "--location");
auto angleSubtended = arguments.value<float>(0.0090f, "--angleSubtended");
auto scale = arguments.value<double>(1.0, "--scale");
double viewingDistance = scale;

Expand Down Expand Up @@ -543,8 +543,8 @@ int main(int argc, char** argv)
{
directionalLight = vsg::DirectionalLight::create();
directionalLight->name = "directional";
directionalLight->color.set(1.0, 1.0, 1.0);
directionalLight->intensity = 0.9;
directionalLight->color.set(1.0f, 1.0f, 1.0f);
directionalLight->intensity = 0.9f;
directionalLight->direction = direction;
directionalLight->angleSubtended = angleSubtended;
directionalLight->shadowSettings = shadowSettings;
Expand All @@ -557,21 +557,21 @@ int main(int argc, char** argv)
{
ambientLight = vsg::AmbientLight::create();
ambientLight->name = "ambient";
ambientLight->color.set(1.0, 1.0, 1.0);
ambientLight->intensity = 0.2;
ambientLight->color.set(1.0f, 1.0f, 1.0f);
ambientLight->intensity = 0.2f;
group->addChild(ambientLight);
}

if (numLights >= 3 && numLights < 4)
{
directionalLight->intensity = 0.7;
ambientLight->intensity = 0.1;
directionalLight->intensity = 0.7f;
ambientLight->intensity = 0.1f;

auto directionalLight2 = vsg::DirectionalLight::create();
directionalLight2->name = "2nd directional";
directionalLight2->color.set(1.0, 1.0, 0.0);
directionalLight2->intensity = 0.7;
directionalLight2->direction = vsg::normalize(vsg::vec3(0.9, 1.0, -1.0));
directionalLight2->color.set(1.0f, 1.0f, 0.0f);
directionalLight2->intensity = 0.7f;
directionalLight2->direction = vsg::normalize(vsg::dvec3(0.9, 1.0, -1.0));
directionalLight2->angleSubtended = angleSubtended;
directionalLight2->shadowSettings = shadowSettings;

Expand All @@ -582,15 +582,15 @@ int main(int argc, char** argv)
{
auto spotLight = vsg::SpotLight::create();
spotLight->name = "spot";
spotLight->color.set(0.0, 1.0, 1.0);
spotLight->intensity = 200.0;
spotLight->color.set(0.0f, 1.0f, 1.0f);
spotLight->intensity = 200.0f;
spotLight->position = vsg::vec3(3.0, 0.5, 15.0);
spotLight->direction = vsg::normalize(vsg::vec3(-0.5, -1, -10));
if (largeScene)
{
spotLight->position = vsg::vec3(3000.0, 500.0, 15000.0);
spotLight->direction = vsg::normalize(vsg::dvec3(500, 500, 0) - spotLight->position);
spotLight->intensity = 15000.0 * 15000.0 / 4.0;
spotLight->intensity = static_cast<float>(15000.0 * 15000.0 / 4.0);
}
spotLight->outerAngle = vsg::radians(10.0);
spotLight->innerAngle = vsg::radians(5.0);
Expand Down
2 changes: 0 additions & 2 deletions examples/nodes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
add_subdirectory(vsgannotation)
add_subdirectory(vsggroups)
add_subdirectory(vsglights)
add_subdirectory(vsgtransform)
add_subdirectory(vsgshadow)
add_subdirectory(vsgtextureprojection)
add_subdirectory(vsglayers)

Expand Down
2 changes: 1 addition & 1 deletion examples/nodes/vsgannotation/vsgannotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class NamedGroup : public vsg::Inherit<experimental::Annotation<vsg::Group>, Nam
public:
NamedGroup()
{
debugColor = vsg::vec4(.8, .8, .8, 1.0);
debugColor = vsg::vec4(.8f, .8f, .8f, 1.0f);
}

using experimental::Annotation<vsg::Group>::accept;
Expand Down
10 changes: 5 additions & 5 deletions examples/nodes/vsglayers/vsglayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ int main(int argc, char** argv)

auto layout = vsg::StandardLayout::create();
layout->horizontalAlignment = vsg::StandardLayout::CENTER_ALIGNMENT;
layout->position = vsg::vec3(0.0, 0.0, 0.0);
layout->horizontal = vsg::vec3(1.0, 0.0, 0.0);
layout->vertical = vsg::vec3(0.0, 0.0, 1.0);
layout->color = vsg::vec4(1.0, 1.0, 1.0, 1.0);
layout->outlineWidth = 0.1;
layout->position = vsg::vec3(0.0f, 0.0f, 0.0f);
layout->horizontal = vsg::vec3(1.0f, 0.0f, 0.0f);
layout->vertical = vsg::vec3(0.0f, 0.0f, 1.0f);
layout->color = vsg::vec4(1.0f, 1.0f, 1.0f, 1.0f);
layout->outlineWidth = 0.1f;

auto text = vsg::Text::create();
text->text = vsg::stringValue::create("Layer");
Expand Down
Loading

0 comments on commit ba0b537

Please sign in to comment.