Q106:Linux系统下安装编译PBRT-V3

106.0 引入

本人之前尝试过在windows系统中编译pbrt-v3,但是出现了很多错误。pbrt-v3的源代码中部分Linux的函数没有用宏包好,而是直接使用,所以在windows环境下就报错了。而且,报错的这些函数和pbrt的“图形”核心并无关系,所以本人不想深入研究这些函数。所以,决定转到Linux系统。所以,也就有了前面安装Linux系统的博文:
Q105:PC双系统:Windows 7下硬盘安装Ubuntu 16.04
http://blog.youkuaiyun.com/libing_zeng/article/details/72273281

(另外,原版电子书相关博文:Physically Based Rendering, Third Edition 第三版电子书

所以,这篇文章记录的是在新安装的Linux系统中安装编译PBRT-V3

106.1 相关步骤

打开Linux终端。

1.安装git;

sudo apt-get install git
sudo apt-get install git-core

2.下载pbrt-v3源代码;

git clone --recursive https://github.com/mmp/pbrt-v3/

3.安装cmake;

sudo apt-get install cmake

4.安装zlib(zlib1g-dev);

sudo apt-get install zlib1g-dev

5.安装bison;

sudo apt-get install bison

6.安装flex;

sudo apt-get install flex

7.在代码文件夹(pbrt-v3)中新建一个文件夹”build”,定位到build文件夹中;

cd ~/pbrt-v3/build

8.cmake ../;

(结束时,会在build文件夹中产生一个makefile文件)

9.make -j4;

(根据前面产生的makefile文件进行编译,编译完成后在build文件夹会产生pbrt、pbrt_test等可执行文件)

10.链接可执行文件;

(以便系统能够找到这些可执行文件)
ln -s ~/pbrt-v3/build/* /usr/bin/

11.找一个场景脚本文件

先来个简单的场景文件。内容如下:

#sharp.pbrt -- a simple pbrt input file that displays a cone, sphere
#              and refletive plane
#Richard P. Sharp - CIS782 Fall 2004

#first we set up the eye
LookAt 1 1 10   0 0 -1  0 1 0 #ex ey ez lx ly lz ux uy uz

#the camera
Camera "perspective" "float fov" [30]

#this is the filter used for antialiasing
PixelFilter "mitchell" "float xwidth" [2] "float ywidth" [2]

#name the file
Film "image" "string filename" ["sharp.exr"]
     "integer xresolution" [400] "integer yresolution" [400]

#begin describing scene
WorldBegin

#light source
AttributeBegin
  CoordSysTransform "camera"
  LightSource "distant" 
              "point from" [0 0 0] "point to"   [0 0 1]
              "color L"    [3 3 3]
AttributeEnd

#transform the world
AttributeBegin
  Translate 0 -1 0
  
通过cypress 上传文件并检查文件是否上传成功 <div class="w-100%"><!--v-if--><div class="el-upload el-upload--text is-drag" tabindex="0"><div class="el-upload-dragger"><!--v-if--><i class="el-icon el-icon--upload"><i class="el-icon v-icon" style="font-size: 40px;"><span class="" style="font-size: 40px; height: 1em;"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="1.37em" height="1em" viewBox="0 0 1920 1408" data-icon="fa:cloud-upload" class="iconify iconify--fa"><path fill="currentColor" d="M1280 736q0-14-9-23L919 361q-9-9-23-9t-23 9L522 712q-10 12-10 24q0 14 9 23t23 9h224v352q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5-9.5t9.5-22.5V768h224q13 0 22.5-9.5t9.5-22.5m640 288q0 159-112.5 271.5T1536 1408H448q-185 0-316.5-131.5T0 960q0-130 70-240t188-165q-2-30-2-43q0-212 150-362T768 0q156 0 285.5 87T1242 318q71-62 166-62q106 0 181 75t75 181q0 76-41 138q130 31 213.5 135.5T1920 1024"></path></svg></span></i></i><div class="el-upload__text" style="color: rgb(12, 97, 182);"> 拖动文件到此处或点击上传</div><div class="el-upload__text mt-10px"> 支持的文件格式:xls、xlsx、pdf、jpg、png、doc、docx、zip、rar、7z,不超过100M </div></div><input class="el-upload__input" name="file" multiple="" accept=".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.zip,.rar,.7z" type="file"></div><!--v-if--><ul class="el-upload-list el-upload-list--text"><li class="el-upload-list__item is-success" tabindex="0"><!--v-if--><div class="el-upload-list__item-info"><a class="el-upload-list__item-name"><i class="el-icon el-icon--document"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"></path></svg></i><span class="el-upload-list__item-file-name" title="立项备案导出.xlsx">立项备案导出.xlsx</span></a><!--v-if--></div><label class="el-upload-list__item-status-label"><i class="el-icon el-icon--upload-success el-icon--circle-check"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"></path><path fill="currentColor" d="M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"></path></svg></i></label><i class="el-icon el-icon--close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg></i><!-- Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn--><!-- This is a bug which needs to be fixed --><!-- TODO: Fix the incorrect navigation interaction --><i class="el-icon--close-tip">按 delete 键可删除</i><!--v-if--></li><li class="el-upload-list__item is-success" tabindex="0"><!--v-if--><div class="el-upload-list__item-info"><a class="el-upload-list__item-name"><i class="el-icon el-icon--document"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"></path></svg></i><span class="el-upload-list__item-file-name" title="sh001.jpg">sh001.jpg</span></a><!--v-if--></div><label class="el-upload-list__item-status-label"><i class="el-icon el-icon--upload-success el-icon--circle-check"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"></path><path fill="currentColor" d="M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"></path></svg></i></label><i class="el-icon el-icon--close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path></svg></i><!-- Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn--><!-- This is a bug which needs to be fixed --><!-- TODO: Fix the incorrect navigation interaction --><i class="el-icon--close-tip">按 delete 键可删除</i><!--v-if--></li></ul></div>
最新发布
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值