// sample rib C++ file -- sample_ribcc.cc // Author: Jorge Balbas // Date: 02/19/09 #include #include #include #include #include using namespace std; int main() { static RtFloat fov = 40, intensity0 = 0.4, intensity1 = 0.7, intensity2 = 0.7, intensity3 = 0.7, intensity4 = 0.7; static RtPoint from1 = {-10.0,12.0,-10.0}, to1 = {10.0,-12.0,0.0}; static RtPoint from2 = {-10.0,-12.0,-10.0}, to2 = {10.0,12.0,0.0}; static RtPoint from3 = {10.0,12.0,-10.0}, to3 = {-10.0,-12.0,0.0}; static RtPoint from4 = {10.0,-12.0,-10.0}, to4 = {-10.0,12.0,0.0}; static RtPoint fpoints[4] = {-80.0, -80.0, 0, 80.0, -80.0, 0.0, 80.0, 80.0, 0.0, -80.0, 80.0, 0.0}; static RtColor curve_color = {1.0, 1.0, 1.0}; static RtColor plane_color = {0.3, 0.3, 0.8}; static RtColor dome_color = {0.2, 0.1, 0.6}; static RtColor ball_color = {0.7, 0.8, 0.0}; static RtColor Os = {0.5, 0.5, 0.5}; char sample_file[25]; RtObjectHandle curve1, curve2, curve3, curve4; sprintf(sample_file, "sample_ribcc.tiff"); RiBegin (RI_NULL); RiProjection ("perspective", "fov", &fov, RI_NULL); RiDisplay (sample_file, "framebuffer", "rgb", RI_NULL); RiDisplay (+sample_file, "file", "rgb", RI_NULL); RiFormat (600, 400, 1); curve1 = RiObjectBegin(); RiTransformBegin(); RiRotate (-15.0, 1, 0, 0); RiRotate (165.0, 0, 0, 1); RiSphere (1.0, -0.73, -0.63, 215, RI_NULL); RiTransformEnd(); RiObjectEnd(); curve2 = RiObjectBegin(); RiTransformBegin(); RiRotate (15.0, 1, 0, 0); RiRotate (165.0, 0, 0, 1); RiSphere (1.0, 0.63, 0.73, 215, RI_NULL); RiTransformEnd(); RiObjectEnd(); curve3 = RiObjectBegin(); RiRotate (90.0, 0, 1, 0); RiTransformBegin(); RiRotate (-15.0, 1, 0, 0); RiRotate (-15.0, 0, 0, 1); RiSphere (1.0, 0.63, 0.73, 215, RI_NULL); RiTransformEnd(); RiObjectEnd(); curve4 = RiObjectBegin(); RiRotate (90.0, 0, 1, 0); RiTransformBegin(); RiRotate (15.0, 1, 0, 0); RiRotate (-15.0, 0, 0, 1); RiSphere (1.0, -0.73, -0.63, 215, RI_NULL); RiTransformEnd(); RiObjectEnd(); RiFrameBegin(1); RiWorldBegin(); RiTranslate (0.0, -1.0, 10.0); RiRotate(85.0, 1, 0, 0); RiRotate(60.0, 0, 0, 1); RiLightSource ("ambientlight", "intensity", &intensity0, RI_NULL); RiLightSource ("distantlight", "intensity", &intensity1, "from", from1, "to", to1, RI_NULL); RiLightSource ("distantlight", "intensity", &intensity2, "from", from2, "to", to2, RI_NULL); RiLightSource ("distantlight", "intensity", &intensity3, "from", from3, "to", to3, RI_NULL); RiLightSource ("distantlight", "intensity", &intensity4, "from", from4, "to", to4, RI_NULL); RiTransformBegin(); RiTranslate (0.0,0.0,-1.5); RiAttributeBegin(); RiColor (curve_color); RiSurface ("matte", RI_NULL); RiObjectInstance (curve1); RiObjectInstance (curve2); RiObjectInstance (curve3); RiObjectInstance (curve4); RiAttributeEnd(); RiTransformEnd(); RiAttributeBegin(); RiTransformBegin(); RiSurface("matte", RI_NULL); RiColor(plane_color); RiPolygon(4, RI_P, (RtPointer)fpoints, RI_NULL); RiTransformEnd(); RiAttributeEnd(); RiAttributeBegin(); RiColor(dome_color); RiTransformBegin(); RiSphere (80.0, -80.0, 0.0, 360.0, RI_NULL); RiTransformEnd(); RiAttributeEnd(); RiWorldEnd(); RiFrameEnd(); RiEnd (); return 0; }