/* Function to draw a single segment of road length */ void bwRoadSegment (GLdouble length, GLdouble width, GLdouble height) { GLdouble cuboid_width = 0.75; GLdouble cur_width = 0; static GLfloat road_texture[] = {0.3, 0.3, 0.3, 1}; static char first = 1; if (first) { srand(time(NULL)); first = 0; } #define RESET_VAL() road_texture[0] = road_texture[1] = road_texture[2] = \ RANDGRAY; #define PRINT_VALS() printf ("%g %g %g\n", road_texture[0], road_texture[1], road_texture[2]); while ( cur_width + cuboid_width <= width ) { glPushMatrix (); glTranslated (0, 0, cur_width); glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, road_texture); bwCuboid (length, cuboid_width, height); glPopMatrix (); cur_width += cuboid_width; RESET_VAL(); } }
#define RESET_VAL(o, rs, prs) { .offset = o, .reset_shift = rs, \ .p_reset_shift = prs } #define DF_VAL(o, kis, kiw, kps, kpw, kas, kaw) { .offset = o, .ki_shift = kis,\ .ki_width = kiw, .kp_shift = kps, .kp_width = kpw, .ka_shift = kas, \ .ka_width = kaw } #define VCO_CTRL_VAL(uo, lo) { .u_offset = uo, .l_offset = lo } #define ENABLE_VAL(o, es, hs, bs) { .offset = o, .enable_shift = es, \ .hold_shift = hs, .bypass_shift = bs } static const struct iproc_pll_ctrl genpll_scr = { .flags = IPROC_CLK_AON | IPROC_CLK_PLL_SPLIT_STAT_CTRL, .aon = AON_VAL(0x0, 1, 15, 12), .reset = RESET_VAL(0x4, 2, 1), .dig_filter = DF_VAL(0x0, 9, 3, 5, 4, 2, 3), .ndiv_int = REG_VAL(0x8, 4, 10), .pdiv = REG_VAL(0x8, 0, 4), .vco_ctrl = VCO_CTRL_VAL(0x10, 0xc), .status = REG_VAL(0x0, 27, 1), }; static const struct iproc_clk_ctrl genpll_scr_clk[] = { /* bypass_shift, the last value passed into ENABLE_VAL(), is not defined * in NS2. However, it doesn't appear to be used anywhere, so setting * it to 0. */ [BCM_NS2_GENPLL_SCR_SCR_CLK] = { .channel = BCM_NS2_GENPLL_SCR_SCR_CLK,