optix学习

#define rtDeclareVariable(type, name, semantic, annotation)

rtDeclareVariable宏定义语法(类型,变量名称,语义,注解)。例如,rtDeclareVariable(uint2, launch_index, rtLaunchIndex, );

这个宏用来定义程序中需要用到的变量(共享变量?)。这个变量可以用来保存一个内部状态,保存一条射线的payload,在相交程序和材料程序中交换属性值等等。

语义可以是如下:

rtLaunchIndex - launch序号。类型需要为unsigned int,unit2, unit3, int, int2, int3之一,并且需为只读。

rtLaunchDim - launch的每个dimension的大小,取值范围1-size。数据类型同上。

rtCurrentRay - 当前活动ray,仅在调用rtTrace时有效。该向量不保证是归一化的。数据类型需要是optix::Ray,并且为只读。

rtCurrentTime - 当前ray time。类型需为float,只读。

rtIntersectionDistance - 当前最近交点距离,当rtTrace被调用时返回。类型为float,只读。

rtRayPayload - 用户定义结构,rtTrace的输入,读写。

属性名称 - 该属性从相交程序intersection program送入closest-hit或any-hit程序。其类型需在两个程序中匹配(?)。该变量在closest-hit或any-hit程序中是只读的,在相交程序中被写入。

使用这个变量的方法

rtContextDeclareVariablertProgramDeclareVariablertSelectorDeclareVariablertGeometryInstanceDeclareVariablertGeometryDeclareVariablertMaterialDeclareVariable

RTresult RTAPI rtProgramDeclareVariable(RTprogramprogram,
const char * name,
RTvariable * 
)

将变量v与程序进行关联。一个变量只能与某个程序关联一次。 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值