• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ color函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中color函数的典型用法代码示例。如果您正苦于以下问题:C++ color函数的具体用法?C++ color怎么用?C++ color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
    system("cls");
    int r,g,a,i,j,e,z,k=0;
    char ch;

   for(i=1,a=I;i<I/2;i++,a--){
       for(j=I-sqrt(I*I-(a-i)*(a-i));j>0;j--)
           printf(" ");
       for(e=1;e<=sqrt(I*I-(a-i)*(a-i));e++)
           {Sleep(10);color(e%16);printf("\3");}
           z=2*sqrt(I*I-(a-i)*(a-i));
       for(;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
           {Sleep(10);color((z-e)%16);printf("\3");}
for(j=2*( I-sqrt(I*I-(a-i)*(a-i)) );j>0;j--)
           printf(" ");
for(e=1;e<=sqrt(I*I-(a-i)*(a-i));e++)
           {Sleep(10);color(e%16);printf("\3");}
           for(;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
           {Sleep(10);color((z-e)%16);printf("\3");}
    printf("\n");
   }

   for(i=1;i<=R/2;i++){
       if(i%2||i%3)continue;
       for(j=R-sqrt(R*R-i*i);j>0;j--)
           printf(" ");
       for(e=1;e<=( sqrt(R*R-i*i) - (R-2*I) );e++)
           {Sleep(10);color(e%16);printf("\3");}
           z=2*( sqrt(R*R-i*i) - (R-2*I) );
           for(;e<=2*( sqrt(R*R-i*i) - (R-2*I) );e++)
           {Sleep(10);color((z-e)%16);printf("\3");}
       printf("\n");
   }
   for(g=1;g<36;g++)
   {
       for(i=1,a=I,r=0;i<I/2;i++,a--,r++){
       gotoxy(g,r);
       for(j=I-sqrt(I*I-(a-i)*(a-i));j>0;j--)
           printf(" ");
       for(e=1;e<=sqrt(I*I-(a-i)*(a-i));e++)
           {color((e+k)%16);printf("\3");}
           z=2*sqrt(I*I-(a-i)*(a-i));
       for(;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
           {color((z-e+k)%16);printf("\3");}
for(j=2*( I-sqrt(I*I-(a-i)*(a-i)) );j>0;j--)
           printf(" ");
for(e=1;e<=sqrt(I*I-(a-i)*(a-i));e++)
           {color((e+k)%16);printf("\3");}
           for(;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
           {color((z-e+k)%16);printf("\3");}
    printf("\n");
   }


   for(i=1;i<=R/2;i++)
   {
       if(i%2||i%3)continue;gotoxy(g,r);r++;
       for(j=R-sqrt(R*R-i*i);j>0;j--)
           printf(" ");
       for(e=1;e<=( sqrt(R*R-i*i) - (R-2*I) );e++)
           {color((e+k)%16);printf("\3");}
           z=2*( sqrt(R*R-i*i) - (R-2*I) );
           for(;e<=2*( sqrt(R*R-i*i) - (R-2*I) );e++)
           {color((z-e+k)%16);printf("\3");}
       printf("\n");
   }

   }
   k=0;


   while(1)
   {
      // system("cls");
       // system("color c");
    gotoxy(0,0);   for(i=0;i<2*k&&i<250;i++)
       {
          color(4);printf("%c",h[i]);
       }
   for(i=1,a=I,r=0;i<I/2;i++,a--,r++){
       gotoxy(35,r);
       for(j=I-sqrt(I*I-(a-i)*(a-i));j>0;j--)
           printf(" ");
       for(e=1;e<=sqrt(I*I-(a-i)*(a-i));e++)
           {color((e+k)%16);printf("\3");}
           z=2*sqrt(I*I-(a-i)*(a-i));
       for(;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
           {color((z-e+k)%16);printf("\3");}
for(j=2*( I-sqrt(I*I-(a-i)*(a-i)) );j>0;j--)
           printf(" ");
for(e=1;e<=sqrt(I*I-(a-i)*(a-i));e++)
           {color((e+k)%16);printf("\3");}
           for(;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
           {color((z-e+k)%16);printf("\3");}
    printf("\n");
   }


   for(i=1;i<=R/2;i++)
//.........这里部分代码省略.........
开发者ID:yudonghua,项目名称:works,代码行数:101,代码来源:main.c


示例2: getCanvasResource

void Panel::Draw() 
{
	//Draw panel
	KrRGBA *pixels = getCanvasResource()->Pixels();
	int width = Width(), height = Height();

	if(flags.IsSet(FLAG_HASSHADOWS))
	{
		  width -= SHADOW_THICKNESS;
		  height -= SHADOW_THICKNESS;
	}

	if(bInvertBevel)
	{
		KrRGBA aux;
		aux = colorUp;
		colorUp = colorDown;
		colorDown = aux;
	}
		

	//Fill background
	int i, j;
	
	for(j = 0; j < height; j++)
	{
		KrRGBA color(SlowCanvas::MixColors(Panel::getColorUp(), Panel::getColorDown(), j/(double)height));
		for(i = 0; i < width; i++)
		{
			pixels[ j*Width() + i ] = color;
		}
	}

	
	//Glass effect
	if(height < 55)
	{
		KrRGBA white(255, 255, 255);
		int hm = height/2;
		for(j = 0; j < hm; j++)
		{
			for(i = 0; i < width; i++)
			{
				pixels[ j*Width() + i ] = SlowCanvas::MixColors(pixels[ j*Width() + i ], white, .8*j/(double)hm);
			}
		}
	}

	KrRGBA colorBorder(104, 104, 104);	

		//Horizontal lines
		for(i = 0; i < width; i++)
		{
			pixels[  i ] = colorBorder;	
			pixels[ (height-1)*Width() + i ] = colorBorder;
		}
		
		//Vertical lines
		for(j = 0; j < height; j++)
		{
			pixels[ j*Width() ] = colorBorder;		
			pixels[ j*Width() + (width-1) ] = colorBorder;
		}

	//Corner pixels
	pixels[ 1 + 1*Width() ] = colorBorder;
	pixels[ (width - 2) + 1*Width() ] = colorBorder;
	pixels[ (width - 2) + (height - 2)*Width() ] = colorBorder;
	pixels[ 1 + (height - 2)*Width() ] = colorBorder;


	

	//Restore colors
	if(bInvertBevel)
	{
		KrRGBA aux;
		aux = colorUp;
		colorUp = colorDown;
		colorDown = aux;
	}

	//Make trasparent corners
	KrRGBA transp(0, 0, 0, 0);

	pixels[ 0 + 0*Width() ] = transp;
	pixels[ 1 + 0*Width() ] = transp;
	pixels[ 0 + 1*Width() ] = transp;

	pixels[ (width - 1) + 0*Width() ] = transp;
	pixels[ (width - 2) + 0*Width() ] = transp;
	pixels[ (width - 1) + 1*Width() ] = transp;

	if(!flags.IsSet(FLAG_HASSHADOWS))
	{
		pixels[ (width - 1) + (height - 1)*Width() ] = transp;
		pixels[ (width - 2) + (height - 1)*Width() ] = transp;
		pixels[ (width - 1) + (height - 2)*Width() ] = transp;
	}

//.........这里部分代码省略.........
开发者ID:cubemoon,项目名称:game-editor,代码行数:101,代码来源:Panel.cpp


示例3: rect

void ArtifactCanvas::draw(QPainter & p) {
  if (! visible()) return;
  p.setRenderHint(QPainter::Antialiasing, true);
  QRect r = rect();
  const BasicData * data = browser_node->get_data();
  FILE * fp = svg();

  if (fp != 0)
    fputs("<g>\n", fp);
  
  const QPixmap * px = 
    ProfiledStereotypes::diagramPixmap(browser_node->get_data()->get_stereotype(), the_canvas()->zoom());
  
  if (px != 0) {
    p.setBackgroundMode(::Qt::TransparentMode);
    
    int lft = (px->width() < width()) ? r.x() + (width() - px->width())/2 : r.x();
    
    p.drawPixmap(lft, r.y(), *px);
    if (fp != 0)
      // pixmap not really exported in SVG
      fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
	      " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
	      svg_color(UmlBlack), lft, r.y(), px->width() - 1, px->height() - 1);
    
    r.moveBy(0, px->height());
    p.setFont(the_canvas()->get_font(UmlNormalBoldFont));
    p.drawText(r, ::Qt::AlignHCenter, browser_node->get_name());
    
    if (fp != 0) {
      draw_text(r, ::Qt::AlignHCenter, browser_node->get_name(), p.font(), fp);
      fputs("</g>\n", fp);
    }
  }
  else {  
    QColor bckgrnd = p.backgroundColor();
    
    p.setBackgroundMode((used_color == UmlTransparent) ? ::Qt::TransparentMode : ::Qt::OpaqueMode);
    
    QColor co = color(used_color);
    
    p.setBackgroundColor(co);
    
    // <<artifact>>/stereotype on 2*font_height with the icon on the right
    // the icon height = 2*font_height
    // the icon width = 3*height/4
    // name on font_height+4 points
    const int four = (int) (4 * the_canvas()->zoom());
    QFontMetrics fm(the_canvas()->get_font(UmlNormalBoldFont));
    const int he = fm.height();
    if (used_color != UmlTransparent) {
      const int shadow = the_canvas()->shadow();
      
      if (shadow != 0) {
	r.setRight(r.right() - shadow);
	r.setBottom(r.bottom() - shadow);
	
	p.fillRect (r.right(), r.top() + shadow,
		    shadow, r.height() - 1,
		    ::Qt::darkGray);
	p.fillRect (r.left() + shadow, r.bottom(),
		    r.width() - 1, shadow,
		    ::Qt::darkGray);
	
	if (fp != 0) {
	  fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\""
		  " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		  QColor(::Qt::darkGray).rgb()&0xffffff,
		  r.right(), r.top() + shadow, shadow - 1, r.height() - 1 - 1);
	  
	  fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\""
		  " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		  QColor(::Qt::darkGray).rgb()&0xffffff,
		  r.left() + shadow, r.bottom(), r.width() - 1 - 1, shadow - 1);
	}
      }
    }
    
    QRect re = r;
    
    if (used_color != UmlTransparent) {
      p.fillRect(r, co);
      
      if (fp != 0)
	fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
		" x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		svg_color(used_color), 
		r.x(), r.y(), r.width() - 1, r.height() - 1);
    }
    else if (fp != 0)
      fprintf(fp, "\t<rect fill=\"none\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
	      " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
	      r.x(), r.y(), r.width() - 1, r.height() - 1);
    
    p.drawRect(r);
    
    r.setHeight(he*2);
    p.setFont(the_canvas()->get_font(UmlNormalFont));
    if (data->get_stereotype()[0]) {
      p.drawText(r, ::Qt::AlignCenter,
//.........这里部分代码省略.........
开发者ID:kralf,项目名称:bouml,代码行数:101,代码来源:ArtifactCanvas.cpp


示例4: wt_status_print_trailer

static void wt_status_print_trailer(struct wt_status *s)
{
	status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
}
开发者ID:spritetong,项目名称:tortoisegit-tgit-utf8,代码行数:4,代码来源:wt-status.c


示例5: wt_status_print

void wt_status_print(struct wt_status *s)
{
	const char *branch_color = color(WT_STATUS_ONBRANCH, s);
	const char *branch_status_color = color(WT_STATUS_HEADER, s);

	if (s->branch) {
		const char *on_what = _("On branch ");
		const char *branch_name = s->branch;
		if (!prefixcmp(branch_name, "refs/heads/"))
			branch_name += 11;
		else if (!strcmp(branch_name, "HEAD")) {
			branch_name = "";
			branch_status_color = color(WT_STATUS_NOBRANCH, s);
			on_what = _("Not currently on any branch.");
		}
		status_printf(s, color(WT_STATUS_HEADER, s), "");
		status_printf_more(s, branch_status_color, "%s", on_what);
		status_printf_more(s, branch_color, "%s\n", branch_name);
		if (!s->is_initial)
			wt_status_print_tracking(s);
	}

	if (s->is_initial) {
		status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
		status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit"));
		status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
	}

	wt_status_print_updated(s);
	wt_status_print_unmerged(s);
	wt_status_print_changed(s);
	if (s->submodule_summary &&
	    (!s->ignore_submodule_arg ||
	     strcmp(s->ignore_submodule_arg, "all"))) {
		wt_status_print_submodule_summary(s, 0);  /* staged */
		wt_status_print_submodule_summary(s, 1);  /* unstaged */
	}
	if (s->show_untracked_files) {
		wt_status_print_other(s, &s->untracked, _("Untracked"), "add");
		if (s->show_ignored_files)
			wt_status_print_other(s, &s->ignored, _("Ignored"), "add -f");
	} else if (s->commitable)
		status_printf_ln(s, GIT_COLOR_NORMAL, _("Untracked files not listed%s"),
			advice_status_hints
			? _(" (use -u option to show untracked files)") : "");

	if (s->verbose)
		wt_status_print_verbose(s);
	if (!s->commitable) {
		if (s->amend)
			status_printf_ln(s, GIT_COLOR_NORMAL, _("No changes"));
		else if (s->nowarn)
			; /* nothing */
		else if (s->workdir_dirty)
			printf(_("no changes added to commit%s\n"),
				advice_status_hints
				? _(" (use \"git add\" and/or \"git commit -a\")") : "");
		else if (s->untracked.nr)
			printf(_("nothing added to commit but untracked files present%s\n"),
				advice_status_hints
				? _(" (use \"git add\" to track)") : "");
		else if (s->is_initial)
			printf(_("nothing to commit%s\n"), advice_status_hints
				? _(" (create/copy files and use \"git add\" to track)") : "");
		else if (!s->show_untracked_files)
			printf(_("nothing to commit%s\n"), advice_status_hints
				? _(" (use -u to show untracked files)") : "");
		else
			printf(_("nothing to commit%s\n"), advice_status_hints
				? _(" (working directory clean)") : "");
	}
}
开发者ID:spritetong,项目名称:tortoisegit-tgit-utf8,代码行数:72,代码来源:wt-status.c


示例6: Fl_Window

InputWindow::InputWindow(int w, int h, const char *label, 
	const char *defaultName, InputWindowType type, int folderIndex) : 
	Fl_Window(MAX(w, 445), h, label), cbUseDefaultNames(NULL), ctFileChooser(NULL), 
	userWindowStatus(OK), fileSelectionIndex(-1)
{	
    string = (char*)malloc(sizeof(char)*90);
    color(GUI_WINDOW_BGCOLOR);
    set_modal();
    windowType = type;
    inputText = (char *) malloc(MAX_BUFFER_SIZE * sizeof(char));

    if(type == InputWindow::FILE_INPUT) {
    	    strncpy(inputText, defaultName, MAX_BUFFER_SIZE - 1);
	    inputText[MAX_BUFFER_SIZE - 1] = '\0';
	    char *extPtr = strrchr(inputText, '.');
	    if(extPtr != NULL) {
	         *extPtr = '\0';
	    }
	    char *filenameStartPtr = strrchr(inputText, '/');
	    int fnameStartPos;
	    if(filenameStartPtr != NULL) {
	         fnameStartPos = filenameStartPtr - inputText;
	    }
	    else {
		 fnameStartPos = 0;
	    }
	    char saveDirInfo[MAX_BUFFER_SIZE];
	    snprintf(saveDirInfo, fnameStartPos + 1, "%s", inputText);
	    sprintf(string, "Export to Directory: %s", saveDirInfo);
	    input = new Fl_Input(25, 50, 235, 30);
	    input->when(FL_WHEN_ENTER_KEY);
	    input->value(filenameStartPtr + 1);
	    Fl_Box *box = new Fl_Box(110, 20, 100, 30, (const char*)string);
	    box->box(FL_NO_BOX);
	    box->align(FL_ALIGN_CENTER);
	    Fl_Box *fileExtBox = new Fl_Box(260,50,30,30,".csv");
	    Fl_Button *button = new Fl_Button(305, 50, 110, 30, "Export to CSV @->");
	    button->callback(InputCallback, (void*)0);
	    button->set_active();
	    input->callback(InputCallback, (void*)0);
	    callback(CloseCallback);
    }
    else if(type == InputWindow::FOLDER_INPUT) {    
	    std::string actualStructName = 
		        ExtractStructureNameFromCTName(defaultName);
            const char *actualStructNameCStr = actualStructName.c_str();
            strncpy(inputText, actualStructNameCStr, actualStructName.size() + 1);
            ConfigParser::nullTerminateString(inputText, actualStructName.size());

	    sprintf(string, "Creating new folder for the CT structure %s", defaultName);
	    input = new Fl_Input(160, 50, 250, 30, "@fileopen  New Folder Name:");
	    input->when(FL_WHEN_ENTER_KEY);
            input->maximum_size(60);
	    input->value(inputText);
	    input->color(GUI_BGCOLOR);
	    input->textcolor(GUI_BTEXT_COLOR);
	    Fl_Box *box = new Fl_Box(50, 1, 350, 40, (const char*) string);
	    box->box(FL_OSHADOW_BOX);
	    box->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
	    box->color(GUI_BGCOLOR);
	    box->labelcolor(GUI_BTEXT_COLOR);
	    Fl_Button *button = new Fl_Button(340, 50, 100, 30, "Add Folder @|>");
	    button->callback(InputCallback, (void*)0);
	    button->labelcolor(GUI_BTEXT_COLOR);
	    button->set_active();
	    input->callback(InputCallback, (void*)0);
	    input->labelcolor(GUI_TEXT_COLOR);
	    const char *cbText = " Use only default names for structure folders";
	    cbUseDefaultNames = new Fl_Check_Button(30, 100, 375, 30, cbText);
	    cbUseDefaultNames->box(FL_ROUND_UP_BOX);
	    cbUseDefaultNames->color(GUI_BGCOLOR);
	    cbUseDefaultNames->labelcolor(GUI_BTEXT_COLOR);
	    cbUseDefaultNames->down_color(GUI_WINDOW_BGCOLOR);
	    cbUseDefaultNames->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CENTER);
	    callback(CloseCallback);
	}
        else { 
	    
	    const char *windowDisplayMsg = "Which CT file structure for the organism\ndo you want to display?";
	    Fl_Box *box = new Fl_Box(75, 5, 300, 40, windowDisplayMsg);
	    box->box(FL_RSHADOW_BOX);
	    box->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
	    box->color(GUI_BGCOLOR);
	    box->labelcolor(GUI_BTEXT_COLOR);
	    Fl_Button *displayButton = new Fl_Button(100, 100, 200, 30, "Display Zoomed Region @|>");
	    displayButton->callback(DisplayCTFileCallback, (void*)0);
	    displayButton->color(GUI_BGCOLOR);
	    displayButton->labelcolor(GUI_BTEXT_COLOR);
	    displayButton->set_active();
	    //displayButton->shortcut(FL_Enter);
	    Fl_Button *cancelButton = new Fl_Button(310, 100, 75, 30, "Cancel @1+");
            cancelButton->callback(CancelCallback); 
	    cancelButton->color(GUI_BGCOLOR);
	    cancelButton->labelcolor(GUI_BTEXT_COLOR);
            
	    ctFileChooser = new Fl_Choice(175, 55, 215, 30, "Choose CT Structure: ");
            ctFileChooser->color(GUI_BGCOLOR);
	    ctFileChooser->labelcolor(GUI_BTEXT_COLOR);

	    StructureManager *structManager = RNAStructViz::GetInstance()->GetStructureManager();
//.........这里部分代码省略.........
开发者ID:gtfold,项目名称:RNAStructViz,代码行数:101,代码来源:InputWindow.cpp


示例7: Range

void ADFun<Base>::SparseJacobianCase(
	const std::set<size_t>&  set_type        ,
	const VectorBase&        x               , 
	const VectorSet&         p               ,
	VectorBase&              jac             )
{
	typedef CppAD::vector<size_t> SizeVector;
	typedef CppAD::vectorBool     VectorBool;
	size_t i, j, k;

	size_t m = Range();
	size_t n = Domain();

	// some values
	const Base zero(0);
	const Base one(1);

	// check VectorSet is Simple Vector class with sets for elements
	CheckSimpleVector<std::set<size_t>, VectorSet>(
		one_element_std_set<size_t>(), two_element_std_set<size_t>()
	);

	// check VectorBase is Simple Vector class with Base type elements
	CheckSimpleVector<Base, VectorBase>();

	CPPAD_ASSERT_KNOWN(
		x.size() == n,
		"SparseJacobian: size of x not equal domain dimension for f"
	); 
	CPPAD_ASSERT_KNOWN(
		p.size() == m,
		"SparseJacobian: using sets and size of p "
		"not equal range dimension for f"
	); 
	CPPAD_ASSERT_UNKNOWN(jac.size() == m * n); 

	// point at which we are evaluating the Jacobian
	Forward(0, x);

	// initialize the return value
	for(i = 0; i < m; i++)
		for(j = 0; j < n; j++)
			jac[i * n + j] = zero;

	// create a copy of the transpose sparsity pattern
	VectorSet q(n);
	std::set<size_t>::const_iterator itr_i, itr_j;
	for(i = 0; i < m; i++)
	{	itr_j = p[i].begin();
		while( itr_j != p[i].end() )
		{	j = *itr_j++;
			q[j].insert(i);
		}
	}	

	if( n <= m )
	{	// use forward mode ----------------------------------------
	
		// initial coloring
		SizeVector color(n);
		for(j = 0; j < n; j++)
			color[j] = j;

		// See GreedyPartialD2Coloring Algorithm Section 3.6.2 of
		// Graph Coloring in Optimization Revisited by
		// Assefaw Gebremedhin, Fredrik Maane, Alex Pothen
		VectorBool forbidden(n);
		for(j = 0; j < n; j++)
		{	// initial all colors as ok for this column
			for(k = 0; k < n; k++)
				forbidden[k] = false;

			// for each row connected to column j
			itr_i = q[j].begin();
			while( itr_i != q[j].end() )
			{	i = *itr_i++;
				// for each column connected to row i
				itr_j = p[i].begin();
				while( itr_j != p[i].end() )
				{	// if this is not j, forbid it
					k = *itr_j++;
					forbidden[ color[k] ] = (k != j);
				}
			}
			k = 0;
			while( forbidden[k] && k < n )
			{	k++;
				CPPAD_ASSERT_UNKNOWN( k < n );
			}
			color[j] = k;
		}
		size_t n_color = 1;
		for(k = 0; k < n; k++) 
			n_color = std::max(n_color, color[k] + 1);

		// direction vector for calls to forward
		VectorBase dx(n);

		// location for return values from Reverse
		VectorBase dy(m);
//.........这里部分代码省略.........
开发者ID:AndreasBrack,项目名称:WahlkreisSeminar,代码行数:101,代码来源:sparse_jacobian.hpp


示例8: color

void btConvexTriangleCallback::processTriangle(btVector3* triangle, int partId, int triangleIndex)
{
	if (!TestTriangleAgainstAabb2(triangle, m_aabbMin, m_aabbMax))
	{
		return;
	}
 
	//just for debugging purposes
	//printf("triangle %d", m_triangleCount++);

	const btCollisionObject* ob = const_cast<btCollisionObject*>(m_triBodyWrap->getCollisionObject());

	btCollisionAlgorithmConstructionInfo ci;
	ci.m_dispatcher1 = m_dispatcher;

	//const btCollisionObject* ob = static_cast<btCollisionObject*>(m_triBodyWrap->getCollisionObject());


#if 1
	///debug drawing of the overlapping triangles
	if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && (m_dispatchInfoPtr->m_debugDraw->getDebugMode() &btIDebugDraw::DBG_DrawWireframe ))
	{
		btVector3 color(1,1,0);
		const btTransform& tr = ob->getWorldTransform();
		m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]), tr(triangle[1]), color);
		m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]), tr(triangle[2]), color);
		m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]), tr(triangle[0]), color);
	}
#endif
	
	if (m_convexBodyWrap->getCollisionShape()->isConvex())
	{
		btTriangleShape tm(triangle[0], triangle[1], triangle[2]);	
		tm.setMargin(m_collisionMarginTriangle);
		
		btCollisionObjectWrapper triObWrap(m_triBodyWrap, &tm, m_triBodyWrap->getCollisionObject(), m_triBodyWrap->getWorldTransform(), partId, triangleIndex);//correct transform?
		btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(m_convexBodyWrap, &triObWrap, m_manifoldPtr);

		const btCollisionObjectWrapper* tmpWrap = 0;

		if (m_resultOut->getBody0Internal() == m_triBodyWrap->getCollisionObject())
		{
			tmpWrap = m_resultOut->getBody0Wrap();
			m_resultOut->setBody0Wrap(&triObWrap);
			m_resultOut->setShapeIdentifiersA(partId, triangleIndex);
		}
		else
		{
			tmpWrap = m_resultOut->getBody1Wrap();
			m_resultOut->setBody1Wrap(&triObWrap);
			m_resultOut->setShapeIdentifiersB(partId, triangleIndex);
		}
	
		colAlgo->processCollision(m_convexBodyWrap, &triObWrap, *m_dispatchInfoPtr, m_resultOut);

		btIDebugDraw *drawer = NULL;
		if (m_dispatchInfoPtr) {
			drawer = m_dispatchInfoPtr->m_debugDraw;
		}

		// Compensate for any internal edge contact points
		btPersistentManifold *manifold = m_resultOut->getPersistentManifold();
		for (int i = 0; i < manifold->getNumContacts(); i++)
		{
			btManifoldPoint &pt = manifold->getContactPoint(i);
			btAdjustInternalEdgeContacts(pt, &triObWrap, m_convexBodyWrap, partId, triangleIndex, BT_TRIANGLE_CONVEX_DOUBLE_SIDED | BT_TRIANGLE_CONCAVE_DOUBLE_SIDED, drawer);
		}

		if (m_resultOut->getBody0Internal() == m_triBodyWrap->getCollisionObject())
		{
			m_resultOut->setBody0Wrap(tmpWrap);
		} else
		{
			m_resultOut->setBody1Wrap(tmpWrap);
		}

		colAlgo->~btCollisionAlgorithm();
		ci.m_dispatcher1->freeCollisionAlgorithm(colAlgo);
	}
}
开发者ID:DrChat,项目名称:Gmod-vphysics,代码行数:80,代码来源:btConvexConcaveCollisionAlgorithm.cpp


示例9: draw_lines

// draw lines connecting pairs of points
void Lines::draw_lines() const
{
    if (color().visibility())
        for (int i=1; i<number_of_points(); i+=2)
            fl_line(point(i-1).x,point(i-1).y,point(i).x,point(i).y);
}
开发者ID:claywd1210,项目名称:classes,代码行数:7,代码来源:Graph.cpp


示例10: main

/*
 * Using polygons, hatching, and filling.
 */
main()
{
	short	val;

	winopen("poly");

	unqdevice(INPUTCHANGE);
	qdevice(KEYBD);		/* enable keyboard */
	/* 
	 * Wait for REDRAW event ...
	 */
	while (qread(&val) != REDRAW)
		;

	color(BLACK);		/* clear to black */
	clear();

	/*
	 * world coordinates are now in the range -10 to 10
	 * in x, y, and z. Note that positive z is towards us.
	 */
	ortho(-10.0, 10.0, -10.0, 10.0, 10.0, -10.0);

	color(YELLOW);

	/*
	 * write out the string "Polygon from poly()" in the
	 * starting at (-8.0, -4.0) and scaled to be 4.0 units long,
	 * 0.5 units high.
	 */
	hfont("futura.m");
	hboxtext(-8.0, -4.0, 4.0, 0.5, "Polygon from poly()/ polf()");

	color(GREEN);

	/*
	 * write out a scaled string starting at (0.0, 6.0)
	 */
	hboxtext(0.0, 6.0, 4.5, 0.5, "Polygon from bgnpoly()/ endpoly()");
	hboxtext(0.0, 5.0, 4.5, 0.5, "             pmv()/ pdr()/ pclos()");

	color(MAGENTA);

	/*
	 * write out a scaled string starting at (0.0, 6.0)
	 */
	hboxtext(3.5, -3.5, 1.9, 0.5, "Arc/ Arcf");

	/*
	 * draw some wire frame polygons
	 */
	drawpoly();

	/*
	 *  rotate so the next polygons will appear in a different place.
	 */
	rot(20.0, 'x');
	rot(30.0, 'y');

	/*
	 * draw some filled polygons.
	 */
	drawpolyf();

	gexit();
}
开发者ID:Milkyway-at-home,项目名称:nemo,代码行数:69,代码来源:poly.c


示例11: read_object_properties

void read_object_properties(lua_State *L, int index,
		ObjectProperties *prop)
{
	if(index < 0)
		index = lua_gettop(L) + 1 + index;
	if(!lua_istable(L, index))
		return;

	prop->hp_max = getintfield_default(L, -1, "hp_max", 10);

	getboolfield(L, -1, "physical", prop->physical);
	getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects);

	getfloatfield(L, -1, "weight", prop->weight);

	lua_getfield(L, -1, "collisionbox");
	if(lua_istable(L, -1))
		prop->collisionbox = read_aabb3f(L, -1, 1.0);
	lua_pop(L, 1);

	getstringfield(L, -1, "visual", prop->visual);

	getstringfield(L, -1, "mesh", prop->mesh);

	lua_getfield(L, -1, "visual_size");
	if(lua_istable(L, -1))
		prop->visual_size = read_v2f(L, -1);
	lua_pop(L, 1);

	lua_getfield(L, -1, "textures");
	if(lua_istable(L, -1)){
		prop->textures.clear();
		int table = lua_gettop(L);
		lua_pushnil(L);
		while(lua_next(L, table) != 0){
			// key at index -2 and value at index -1
			if(lua_isstring(L, -1))
				prop->textures.push_back(lua_tostring(L, -1));
			else
				prop->textures.push_back("");
			// removes value, keeps key for next iteration
			lua_pop(L, 1);
		}
	}
	lua_pop(L, 1);

	lua_getfield(L, -1, "colors");
	if (lua_istable(L, -1)) {
		int table = lua_gettop(L);
		prop->colors.clear();
		for (lua_pushnil(L); lua_next(L, table); lua_pop(L, 1)) {
			video::SColor color(255, 255, 255, 255);
			read_color(L, -1, &color);
			prop->colors.push_back(color);
		}
	}
	lua_pop(L, 1);

	lua_getfield(L, -1, "spritediv");
	if(lua_istable(L, -1))
		prop->spritediv = read_v2s16(L, -1);
	lua_pop(L, 1);

	lua_getfield(L, -1, "initial_sprite_basepos");
	if(lua_istable(L, -1))
		prop->initial_sprite_basepos = read_v2s16(L, -1);
	lua_pop(L, 1);

	getboolfield(L, -1, "is_visible", prop->is_visible);
	getboolfield(L, -1, "makes_footstep_sound", prop->makes_footstep_sound);
	getfloatfield(L, -1, "automatic_rotate", prop->automatic_rotate);
	if (getfloatfield(L, -1, "stepheight", prop->stepheight))
		prop->stepheight *= BS;
	lua_getfield(L, -1, "automatic_face_movement_dir");
	if (lua_isnumber(L, -1)) {
		prop->automatic_face_movement_dir = true;
		prop->automatic_face_movement_dir_offset = luaL_checknumber(L, -1);
	} else if (lua_isboolean(L, -1)) {
		prop->automatic_face_movement_dir = lua_toboolean(L, -1);
		prop->automatic_face_movement_dir_offset = 0.0;
	}
	lua_pop(L, 1);
	getboolfield(L, -1, "backface_culling", prop->backface_culling);

	getstringfield(L, -1, "nametag", prop->nametag);
	lua_getfield(L, -1, "nametag_color");
	if (!lua_isnil(L, -1)) {
		video::SColor color = prop->nametag_color;
		if (read_color(L, -1, &color))
			prop->nametag_color = color;
	}
	lua_pop(L, 1);

	lua_getfield(L, -1, "automatic_face_movement_max_rotation_per_sec");
	if (lua_isnumber(L, -1)) {
		prop->automatic_face_movement_max_rotation_per_sec = luaL_checknumber(L, -1);
	}
	lua_pop(L, 1);
	getstringfield(L, -1, "infotext", prop->infotext);
}
开发者ID:grigoriis,项目名称:MultiCraft,代码行数:100,代码来源:c_content.cpp


示例12: ex10_1

/* >>>>>>>>>> EX10_1 <<<<<<<<<< */
void ex10_1 (void)
{ int nya = 2700, i;
  static char   *ctit = "Bar Graphs (BARS)", cbuf[25];

  static float x[9]  = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f},
               y[9]  = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f},
               y1[9] = {1.f, 1.5f, 2.5f, 1.3f, 2.0f, 1.2f, 0.7f, 1.4f, 1.1f},
               y2[9] = {2.f, 2.7f, 3.5f, 2.1f, 3.2f, 1.9f, 2.0f, 2.3f, 1.8f},
               y3[9] = {4.f, 3.5f, 4.5f, 3.7f, 4.0f, 2.9f, 3.0f, 3.2f, 2.6f};

  setpag ("da4p");
  disini ();
  pagera ();
  hwfont ();
  ticks  (1, "x");
  intax  ();;
  axslen (1600, 700);
  titlin (ctit, 3);

  legini (cbuf, 3, 8);
  leglin (cbuf, "FIRST", 1);
  leglin (cbuf, "SECOND", 2);
  leglin (cbuf, "THIRD", 3);
  legtit (" ");
  shdpat (5L);
  for (i = 1; i <= 3; i++)
  { if (i >  1) labels ("none", "x");
    axspos (300, nya - (i - 1) * 800);
    graf   (0.f, 10.f, 0.f, 1.f, 0.f, 5.f, 0.f, 1.f);

    if (i == 1)
    { bargrp (3, 0.15f);
      color  ("red");
      bars   (x, y, y1, 9);
      color  ("green");
      bars   (x, y, y2, 9);
      color  ("blue");
      bars   (x, y, y3, 9);
      color  ("fore");
      reset  ("bargrp");
    }
    else if (i == 2)
    { height (30);
      labels ("delta", "bars");
      labpos ("center", "bars");
      color  ("red");
      bars   (x, y, y1, 9);
      color  ("green");
      bars   (x, y1, y2, 9);
      color  ("blue");
      bars   (x, y2, y3, 9);
      color  ("fore");
      reset  ("height"); 
    }
    else if (i == 3)
    { labels ("second", "bars");
      labpos ("outside", "bars");
      color  ("red");
      bars   (x, y, y1, 9);
      color  ("fore");
    }

    if (i != 3) legend (cbuf, 7);

    if (i == 3)
    { height (50);
      title  ();
    }

    endgrf ();
  }
  disfin ();
}
开发者ID:kastur,项目名称:artificial_birds,代码行数:74,代码来源:exa_c.c


示例13: pixel_tests

static void pixel_tests(struct test *t, int reps, int sets, enum target target)
{
	struct test_target tt;
	XImage image;
	uint32_t *cells = malloc(t->real.width*t->real.height*4);
	struct {
		uint16_t x, y;
	} *pixels = malloc(reps*sizeof(*pixels));
	int r, s;

	printf("Testing setting of single pixels (%s): ", test_target_name(target));
	fflush(stdout);

	test_target_create_render(&t->real, target, &tt);

	for (s = 0; s < sets; s++) {
		for (r = 0; r < reps; r++) {
			int x = rand() % (tt.width - 1);
			int y = rand() % (tt.height - 1);
			int red = rand() % 0xff;
			int green = rand() % 0xff;
			int blue = rand() % 0xff;
			int alpha = rand() % 0xff;

			fill_rect(&t->real, tt.picture, PictOpSrc,
				  x, y, 1, 1,
				  0, 0, MASK_NONE,
				  red, green, blue, alpha);

			pixels[r].x = x;
			pixels[r].y = y;
			cells[y*t->real.width+x] = color(red, green, blue, alpha);
		}

		test_init_image(&image, &t->real.shm, tt.format, 1, 1);

		for (r = 0; r < reps; r++) {
			uint32_t result;
			uint32_t x = pixels[r].x;
			uint32_t y = pixels[r].y;

			XShmGetImage(t->real.dpy, tt.draw, &image,
				     x, y, AllPlanes);

			result = *(uint32_t *)image.data;
			if (!pixel_equal(image.depth, result,
					 cells[y*tt.width+x])) {
				uint32_t mask = depth_mask(image.depth);
				die("failed to set pixel (%d,%d) to %08x [%08x], found %08x [%08x] instead\n",
				    x, y,
				    cells[y*tt.width+x] & mask,
				    cells[y*tt.width+x],
				    result & mask,
				    result);
			}
		}
	}
	printf("passed [%d iterations x %d]\n", reps, sets);

	test_target_destroy_render(&t->real, &tt);

	free(pixels);
	free(cells);
}
开发者ID:krlmlr-archive,项目名称:xserver-xorg-video-intel,代码行数:64,代码来源:render-trapezoid.c


示例14: DrawShape

void b2World::DrawDebugData()
{
	if (m_debugDraw == NULL)
	{
		return;
	}

	uint32 flags = m_debugDraw->GetFlags();

	if (flags & b2Draw::e_shapeBit)
	{
		for (b2Body* b = m_bodyList; b; b = b->GetNext())
		{
			const b2Transform& xf = b->GetTransform();
			for (b2Fixture* f = b->GetFixtureList(); f; f = f->GetNext())
			{
				if (b->IsActive() == false)
				{
					DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.3f));
				}
				else if (b->GetType() == b2_staticBody)
				{
					DrawShape(f, xf, b2Color(0.5f, 0.9f, 0.5f));
				}
				else if (b->GetType() == b2_kinematicBody)
				{
					DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.9f));
				}
				else if (b->IsAwake() == false)
				{
					DrawShape(f, xf, b2Color(0.6f, 0.6f, 0.6f));
				}
				else
				{
					DrawShape(f, xf, b2Color(0.9f, 0.7f, 0.7f));
				}
			}
		}
	}

	if (flags & b2Draw::e_jointBit)
	{
		for (b2Joint* j = m_jointList; j; j = j->GetNext())
		{
			DrawJoint(j);
		}
	}

	if (flags & b2Draw::e_pairBit)
	{
		b2Color color(0.3f, 0.9f, 0.9f);
		for (b2Contact* c = m_contactManager.m_contactList; c; c = c->GetNext())
		{
			//b2Fixture* fixtureA = c->GetFixtureA();
			//b2Fixture* fixtureB = c->GetFixtureB();

			//b2Vec2 cA = fixtureA->GetAABB().GetCenter();
			//b2Vec2 cB = fixtureB->GetAABB().GetCenter();

			//m_debugDraw->DrawSegment(cA, cB, color);
		}
	}

	if (flags & b2Draw::e_aabbBit)
	{
		b2Color color(0.9f, 0.3f, 0.9f);
		b2BroadPhase* bp = &m_contactManager.m_broadPhase;

		for (b2Body* b = m_bodyList; b; b = b->GetNext())
		{
			if (b->IsActive() == false)
			{
				continue;
			}

			for (b2Fixture* f = b->GetFixtureList(); f; f = f->GetNext())
			{
				for (int32 i = 0; i < f->m_proxyCount; ++i)
				{
					b2FixtureProxy* proxy = f->m_proxies + i;
					b2AABB aabb = bp->GetFatAABB(proxy->proxyId);
					b2Vec2 vs[4];
					vs[0].Set(aabb.lowerBound.x, aabb.lowerBound.y);
					vs[1].Set(aabb.upperBound.x, aabb.lowerBound.y);
					vs[2].Set(aabb.upperBound.x, aabb.upperBound.y);
					vs[3].Set(aabb.lowerBound.x, aabb.upperBound.y);

					m_debugDraw->DrawPolygon(vs, 4, color);
				}
			}
		}
	}

	if (flags & b2Draw::e_centerOfMassBit)
	{
		for (b2Body* b = m_bodyList; b; b = b->GetNext())
		{
			b2Transform xf = b->GetTransform();
			xf.p = b->GetWorldCenter();
			m_debugDraw->DrawTransform(xf);
//.........这里部分代码省略.........
开发者ID:JamesBuggy,项目名称:Final-Year-Project,代码行数:101,代码来源:b2World.cpp


示例15: DbgAssert

int PointHelpObject::DrawAndHit(TimeValue t, INode *inode, ViewExp *vpt)
	{
	
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	float size;
	int centerMarker, axisTripod, cross, box, screenSize, drawOnTop;

	Color color(inode->GetWireColor());	

	Interval ivalid = FOREVER;
	pblock2->GetValue(pointobj_size, t,         size, ivalid);
	pblock2->GetValue(pointobj_centermarker, t, centerMarker, ivalid);
	pblock2->GetValue(pointobj_axistripod, t,   axisTripod, ivalid);
	pblock2->GetValue(pointobj_cross, t,        cross, ivalid);
	pblock2->GetValue(pointobj_box, t,          box, ivalid);
	pblock2->GetValue(pointobj_screensize, t,   screenSize, ivalid);
	pblock2->GetValue(pointobj_drawontop, t,    drawOnTop, ivalid);
	
	Matrix3 tm(1);
	Point3 pt(0,0,0);
	Point3 pts[5];

	vpt->getGW()->setTransform(tm);	
	tm = inode->GetObjectTM(t);

	int limits = vpt->getGW()->getRndLimits();
	if (drawOnTop) vpt->getGW()->setRndLimits(limits & ~GW_Z_BUFFER);

	if (inode->Selected()) {
		vpt->getGW()->setColor( TEXT_COLOR, GetUIColor(COLOR_SELECTION) );
		vpt->getGW()->setColor( LINE_COLOR, GetUIColor(COLOR_SELECTION) );
	} else if (!inode->IsFrozen() && !inode->Dependent()) {
		//vpt->getGW()->setColor( TEXT_COLOR, GetUIColor(COLOR_POINT_AXES) );
		//vpt->getGW()->setColor( LINE_COLOR, GetUIColor(COLOR_POINT_AXES) );		
		vpt->getGW()->setColor( TEXT_COLOR, color);
		vpt->getGW()->setColor( LINE_COLOR, color);
		}	

	if (axisTripod) {
		DrawAxis(vpt, tm, size, screenSize);
		}
	
	size *= 0.5f;

	float zoom = vpt->GetScreenScaleFactor(tm.GetTrans())*ZFACT;
	if (screenSize) {
		tm.Scale(Point3(zoom,zoom,zoom));
		}

	vpt->getGW()->setTransform(tm);

	if (!inode->IsFrozen() && !inode->Dependent() && !inode->Selected()) {
		//vpt->getGW()->setColor(LINE_COLOR, GetUIColor(COLOR_POINT_OBJ));
		vpt->getGW()->setColor( LINE_COLOR, color);
		}

	if (centerMarker) {		
		vpt->getGW()->marker(&pt,X_MRKR);
		}

	if (cross) {
		// X
		pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(size, 0.0f, 0.0f);
		vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);

		// Y
		pts[0] = Point3(0.0f, -size, 0.0f); pts[1] = Point3(0.0f, size, 0.0f);
		vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);

		// Z
		pts[0] = Point3(0.0f, 0.0f, -size); pts[1] = Point3(0.0f, 0.0f, size);
		vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
		}

	if (box) {

		// Make the box half the size
		size = size * 0.5f;

		// Bottom
		pts[0] = Point3(-size, -size, -size); 
		pts[1] = Point3(-size,  size, -size);
		pts[2] = Point3( size,  size, -size);
		pts[3] = Point3( size, -size, -size);
		vpt->getGW()->polyline(4, pts, NULL, NULL, TRUE, NULL);

		// Top
		pts[0] = Point3(-size, -size,  size); 
		pts[1] = Point3(-size,  size,  size);
		pts[2] = Point3( size,  size,  size);
		pts[3] = Point3( size, -size,  size);
		vpt->getGW()->polyline(4, pts, NULL, NULL, TRUE, NULL);

		// Sides
//.........这里部分代码省略.........
开发者ID:mathieumg,项目名称:inf4715,代码行数:101,代码来源:pthelp.cpp


示例16: Init

   void Init(CompositeNode* root, MeshFileLoader* MeshLoader )
   {
      // glDisable(GL_CULL_FACE);
      // glEnable(GL_CULL_FACE);
      // glCullFace(GL_BACK);
      // m = mfl->Load("Objects/cube.obj");
      // g = new Geometry(m, "Geometry");
      // g->SetMesh( m );
      
      Mesh* Magnolia = MeshLoader->Load("Objects/magnolia.obj");
      Magnolia->Scale(0.03f);
      Mesh* Rose = MeshLoader->Load("Objects/rose+vase.obj");
      Rose->Scale(0.03f);
      //Mesh* Dolphins = MeshLoader->Load("Objects/dolphins.obj");
	//Dolphins->Scale(0.01f);
      Mesh* Skyscraper = MeshLoader->Load("Objects/skyscraper.obj");
      Skyscraper->Scale(0.04f);
      
        


        M3DVector3f pos;
        m3dLoadVector3( pos, 0.0f, 0.0f, 50.0f );
        if (_camera) DLOG(INFO) << "_camera address: " << _camera << endl;
       
        _camera->SetPosition( pos );
         Vector4 color( 1.0f, 1.0f, 1.0f, 1.0f );
      	 _light->SetDiffuse( color );
         _light->SetAmbient( color );

	// M3DVector3f pos;
	// m3dLoadVector3( pos, 0.0f, 0.0f, 10.0f );

	// Init Camera
    //     Camera* c = reinterpret_cast<Camera*>(l->GetByName("GlobalCamera"));
    // c->SetPosition( pos );
    // c->SetPerspective(45.0f,(GLfloat)800/(GLfloat)600,0.1f,100.0f);

	// Build Up Scenegraph
	 _camera->AddChild(
	 	(new Transform(string("MagnoliaTransform")))->AddChild(
	 		(new Geometry(Magnolia, string("Magnolia")))
	 ));
         _camera->AddChild(
	 	(new Transform(string("RoseTransform")))->AddChild(
	 		(new Geometry(Rose, "Rose")))
	 );
         _camera->AddChild(
	 	(new Transform(string("SkyscraperTransform")))->AddChild(
	 		(new Geometry(Skyscraper, "Skyscraper")))
	 );

	 Transform* t = dynamic_cast<Transform*>(root->GetByName("MagnoliaTransform"));
	 t->Rotate(20.0f, 1.0f, 1.0f, 1.0f);
	 t->Translate(-3.0f, 0.0f, 0.0f);

	 t = dynamic_cast<Transform*>(root->GetByName("RoseTransform"));
	 t->Translate(2.0f, 0.0f, 0.0f);
	 t->Rotate(20.0f, 1.0f, 1.0f, 1.0f);
	 t->Scale(1.6f, 1.2f, 1.2f);

	 t = dynamic_cast<Transform*>(root->GetByName("SkyscraperTransform"));
	 t->Rotate(50.0f, 1.0f, 1.0f, 1.0f);

         update = t;

         UpdateVisitorFactory fact;
        
        visitor = fact.CreateTransformationVisitor( ROTATE, 1.0f, 0.0f, 0.0f, 0.01f );
        visitor2 = fact.CreateTransformationVisitor( SCALE, 1.002f, 1.0f, 1.0f );
   };
开发者ID:patrickuhlmann,项目名称:OpenGL-Scenegraph,代码行数:71,代码来源:TestGraphApp.cpp


示例17: construct

static void construct(QVariant::Private *x, const void *copy)
{
    switch (x->type) {
    case QVariant::Bitmap:
        v_construct<QBitmap>(x, copy);
        break;
    case QVariant::Region:
        v_construct<QRegion>(x, copy);
        break;
    case QVariant::Polygon:
        v_construct<QPolygon>(x, copy);
        break;
    case QVariant::Font:
        v_construct<QFont>(x, copy);
        break;
    case Q 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ colorChanged函数代码示例发布时间:2022-05-30
下一篇:
C++ colon函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap