1. 程式人生 > >vex 從放棄到入門

vex 從放棄到入門

style detail one elf nts primitive spl color cnblogs

1.point 模式

技術分享

技術分享
int snpt = npoints(1);
int spt_num = fit(ch("cur_pos"),0,1,0,snpt-1);
vector cur_pos = point(1,"P",spt_num);
@P += cur_pos;
View Code

技術分享

技術分享

2.detail 模式

技術分享
int npt_l = npoints(0);
int npt_r = npoints(1);
int npt_r1 = fit(ch("cur_pos"),0,1,0,npt_r-1);
vector cur_pos = point(1,"P",npt_r1);
for(int
i =0; i<npt_l;i++) { vector sphere_pos = point(0,"P",i); sphere_pos += cur_pos; setpointattrib(geoself(),"P",i,sphere_pos); }
View Code

3.detail 模式 四邊形 插入點

技術分享

技術分享
int nprm_t = nprimitives(1);
int add_points = ch("add_points");
for(int i = 0;i<nprm_t;i++)
{
    int spt_num1 = primpoint(1
,i,0); int spt_num2 = primpoint(1,i,1); int spt_num3 = primpoint(1,i,3); vector tmp1 = point(1,"P",spt_num1); vector tmp2 = point(1,"P",spt_num2); vector tmp3 = point(1,"P",spt_num3); vector tmpU = tmp2 - tmp1; vector tmpV = tmp3 - tmp1; vector tmp = set(0,0,0);
for(int j = 0; j< add_points ;j++) { float r1 = rand(j+1); float r2 = rand(j*10+3); tmp = tmpU*r1 + tmpV*r2; tmp += tmp1; int rtn = addpoint(geoself(),tmp); } }
View Code

技術分享

4.detail 模式 三角面 插入點

...

vex 從放棄到入門