本文整理汇总了C++中Light::LightColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::LightColor方法的具体用法?C++ Light::LightColor怎么用?C++ Light::LightColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::LightColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: R_igraph_getsphere
SEXP R_igraph_getsphere(SEXP pos, SEXP radius, SEXP color, SEXP bgcolor,
SEXP lightpos, SEXP lightcolor, SEXP width,
SEXP height) {
/* All error checking is done at the R level */
int i;
double *spos=REAL(pos);
double *scolor=REAL(color);
double *svgcolor=REAL(bgcolor);
int no_lights=GET_LENGTH(lightpos);
RayTracer* p_ray_tracer;
Sphere * sphere;
int swidth=INTEGER(width)[0];
int sheight=INTEGER(height)[0];
int nopixels=swidth * sheight;
SEXP result, dim;
Image image;
p_ray_tracer = new RayTracer();
p_ray_tracer->EyePoint(Point(0,0,0));
for (i=0; i<no_lights; i++) {
double *lpos=REAL(VECTOR_ELT(lightpos, i));
double *lcol=REAL(VECTOR_ELT(lightcolor, i));
Light *light = new Light(Point(lpos[0], lpos[1], lpos[2]));
light->Intensity(1);
light->LightColor(Color(lcol[0], lcol[1], lcol[2]));
p_ray_tracer->AddLight(light);
}
sphere = new Sphere(Point(spos[0], spos[1], spos[2]), REAL(radius)[0]);
sphere->ShapeColor(Color(scolor[0], scolor[1], scolor[2]));
p_ray_tracer->AddShape(sphere);
PROTECT(result=NEW_NUMERIC(nopixels * 4));
PROTECT(dim=NEW_INTEGER(3));
INTEGER(dim)[0]=swidth; INTEGER(dim)[1]=sheight; INTEGER(dim)[2]=4;
SET_DIM(result, dim);
image.width=swidth;
image.height=sheight;
image.red=REAL(result);
image.green=image.red + nopixels;
image.blue=image.green + nopixels;
image.trans=image.blue + nopixels;
p_ray_tracer->RayTrace(image);
delete p_ray_tracer;
UNPROTECT(2);
return result;
}