怎样建设一个好的网站建设网站需要哪些元素
2026/1/22 8:07:58 网站建设 项目流程
怎样建设一个好的网站,建设网站需要哪些元素,怎样做网站卖网站,婚庆网站大全Win10系统VS2019Cmakevtk_8.2.0环境配置 1 vtk 1.1 简要介绍 VTK#xff08;visualization toolkit#xff09; 是一个开源的 BSD 许可证免费软件系统#xff0c;主要用于三维计算机图形学、图像处理和科学计算可视化。 VTK 是在三角函数库 OpenGL 的基础上采用面向对象的…Win10系统VS2019Cmakevtk_8.2.0环境配置1 vtk1.1 简要介绍VTKvisualization toolkit是一个开源的BSD许可证免费软件系统主要用于三维计算机图形学、图像处理和科学计算可视化。VTK是在三角函数库OpenGL的基础上采用面向对象的设计方法发展起来的它将我们在可视化开发过程中会经常遇到的细节屏蔽起来并将一些常用的算法封装起来。1.2 依赖库vtk一般不需要再配置其他库。1.2.1 MPI非必选如果想要编译vtkIOMPIImage或vtkIOMPIParallel模块需要依赖MPI库用于加速。MPI库下载地址https://www.microsoft.com/en-us/download/details.aspx?id57467注对于编译vtk下载msmpisdk.msi即可即MPI库的SDK安装后生成include和Lib两个文件夹。1.3 源码包下载vtk源码地址github https://github.com/Kitware/VTK.git2Cmake构建项目2.1 路径源代码路径D:/ThirdParty/vtk/VTK_8.2.0构建项目路径D:/ThirdParty/vtk/VTK_8.2.0_build2.2 构建选项名称值备注BUILD_TESTINGfalseCMAKE_INSTALL_PREFIXpath编译时生成的安装文件路径CMAKE_DEBUG_POSTFIX-ddebug版本库名称后缀需要勾选Cmake中的AdvancedCMAKE_CXX_MP_FLAGtrue如果想要编译vtkIOMPIImage或vtkIOMPIParallel这两个模块还需要如下设置名称值备注Module_vtkIOMPIImagetrue编译vtkIOMPIImage模块Module_vtkIOMPIParalleltrue编译vtkIOMPIParallel模块VTK_Group_MPItrueMPI_CXX_INCLUDE_PATHpathMPI库Include文件夹路径../mpi/IncludeMPI_CXX_LIBRARIESpathMPI库Lib文件夹路径../mpi/Lib/x64MPI_C_INCLUDE_PATHpathMPI库Include文件夹路径../mpi/IncludeMPI_C_LIBRARIESpathMPI库Lib文件夹路径../mpi/Lib/x64注这样的配置仅能保证Configure能过Generate代码时会有一堆报警但也能成功生成项目但这在编译vtkParallelMPIvtkIOMPIImage和vtkIOParallelNetCDF这3个项目时仍会报MPI中无法解析的外部符号错误我是针对这3个项目在附加依赖项中手动添加了MPI库Lib/x64文件夹下的几个库文件名我对cmake不熟没有找到更好的办法大家要是有更好的方法欢迎留言赐教。另外针对这3个项目在附加库目录中手动添加了MPI库Include/x64文件夹的路径。2.3 构建项目步骤如下指定源码路径指定构建项目路径点击Configure按照2.2节表中的值进行设置再次点击Configure点击Generate构建项目路径中将生成解决方案文件VTK.sln。点击Configure或Generate后如果顺利会出现Configuring done或Generating done。3 打开解决方案并编译3.1 编译解决方案点击Open Project或者在2.3节步骤2中指定的构建项目路径中找到生成的解决方案文件VTK.sln通过Visual Studio打开打开通过Cmake构建的项目选中ALL_BUILD项目分别在Debug和Release模式下重新生成解决方案。3.2 安装vtk选中INSTALL项目右击重新生成此时将会在指定路径下2.2节表中CMAKE_INSTALL_PREFIX选项的值主要生成3个文件夹include和lib和bin。4 实际项目环境配置注以下通过属性表的方式进行环境配置。4.1 附加包含目录$(vtk)\vtk-8.2\include$(vtk)在系统环境变量中添加并设置就是2.2节表中CMAKE_INSTALL_PREFIX选项的值。4.2 附加库目录$(vtk)\lib4.3 附加依赖项将库目录$(vtk)\lib中文件后缀名为.lib的文件依次添加至附加依赖项中并依次配置debug版本文件名中有d和release版本。注意添加附加依赖项时不要漏掉文件后缀名.lib4.4动态库将动态库目录添加至系统环境变量Path步骤如下计算机右击点击“属性”点击“高级系统设置”点击“环境变量”双击Path添加%vtk%\bin该目录下是包含了动态库文件。本文使用的都是相对路径因此需事先设置好环境变量vtk值为CMAKE_INSTALL_PREFIX对应的目录也可以使用绝对路径。注上述步骤是按照加载vtk动态库的方式进行配置的当然也可以按照静态库的方式配置可省略步骤4.4。4.5 测试代码/* Program: Visualization Toolkit Module: Cone.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. *///// This example creates a polygonal model of a cone, and then renders it to// the screen. It will rotate the cone 360 degrees and then exit. The basic// setup of source - mapper - actor - renderer - renderwindow is// typical of most VTK programs.//// First include the required header files for the VTK classes we are using.#includevtkAutoInit.hVTK_MODULE_INIT(vtkRenderingOpenGL2);VTK_MODULE_INIT(vtkInteractionStyle);VTK_MODULE_INIT(vtkRenderingFreeType);//#define vtkRenderingCore_AUTOINIT 2(vtkInteractionStyle,vtkRenderingOpenGL2)#includevtkConeSource.h#includevtkPolyDataMapper.h#includevtkRenderWindow.h#includevtkCamera.h#includevtkActor.h#includevtkRenderer.hintmain(){//// Next we create an instance of vtkConeSource and set some of its// properties. The instance of vtkConeSource cone is part of a// visualization pipeline (it is a source process object); it produces data// (output type is vtkPolyData) which other filters may process.//vtkConeSource*conevtkConeSource::New();cone-SetHeight(3.0);cone-SetRadius(1.0);cone-SetResolution(10);//// In this example we terminate the pipeline with a mapper process object.// (Intermediate filters such as vtkShrinkPolyData could be inserted in// between the source and the mapper.) We create an instance of// vtkPolyDataMapper to map the polygonal data into graphics primitives. We// connect the output of the cone source to the input of this mapper.//vtkPolyDataMapper*coneMappervtkPolyDataMapper::New();coneMapper-SetInputConnection(cone-GetOutputPort());//// Create an actor to represent the cone. The actor orchestrates rendering// of the mappers graphics primitives. An actor also refers to properties// via a vtkProperty instance, and includes an internal transformation// matrix. We set this actors mapper to be coneMapper which we created// above.//vtkActor*coneActorvtkActor::New();coneActor-SetMapper(coneMapper);//// Create the Renderer and assign actors to it. A renderer is like a// viewport. It is part or all of a window on the screen and it is// responsible for drawing the actors it has. We also set the background// color here.//vtkRenderer*ren1vtkRenderer::New();ren1-AddActor(coneActor);ren1-SetBackground(0.1,0.2,0.4);//// Finally we create the render window which will show up on the screen.// We put our renderer into the render window using AddRenderer. We also// set the size to be 300 pixels by 300.//vtkRenderWindow*renWinvtkRenderWindow::New();renWin-AddRenderer(ren1);renWin-SetSize(300,300);//// Now we loop over 360 degrees and render the cone each time.//inti;for(i0;i360;i){// render the imagerenWin-Render();// rotate the active camera by one degreeren1-GetActiveCamera()-Azimuth(1);}//// Free up any objects we created. All instances in VTK are deleted by// using the Delete() method.//cone-Delete();coneMapper-Delete();coneActor-Delete();ren1-Delete();renWin-Delete();std::system(pause);return0;}如果编译时报错提示error LNK2019:无法解析的外部符号 __imp_SymGetLineFromAddr64解决方案如下“项目”–“属性”–“链接器”–“输入”–“附加依赖项”添加dgbhelp.lib。如果运行时报错提示Error: no override found for vtkPolyDataMapper解决方案如下在附加依赖项中添加opengl32.lib程序开头添加如下代码#includevtkAutoInit.hVTK_MODULE_INIT(vtkRenderingOpenGL2);// 也有可能是VTK_MODULE_INIT(vtkRenderingOpenGL);VTK_MODULE_INIT(vtkInteractionStyle);VTK_MODULE_INIT(vtkRenderingFreeType);或者程序开头直接添加一句代码#define vtkRenderingCore_AUTOINIT 2(vtkInteractionStyle,vtkRenderingOpenGL2)。这句代码来源于编译代码生成目录D:\ThirdParty\vtk\VTK_8.2.0_build\CMakeFiles下的vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingOpenGL2.h文件内。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询