当前位置: 首页>>代码示例>>C++>>正文


C++ CColor::Set方法代码示例

本文整理汇总了C++中CColor::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ CColor::Set方法的具体用法?C++ CColor::Set怎么用?C++ CColor::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CColor的用法示例。


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

示例1: BuzzDebugRayAdd

int BuzzDebugRayAdd(buzzvm_t vm) {
   /*
    * Possible signatures
    * debug.rays.add(r,g,b, x,y,z)
    *    draws a ray from the reference point of the robot to (x,y,z).
    *    (x,y,z) is expressed wrt the robot reference frame
    * debug.rays.add(r,g,b, x0,y0,z0, x1,y1,z1)
    *    draws a ray from (x0,y0,z0) to (x1,y1,z1)
    *    (x0,y0,z0) and (x1,y1,z1) are expressed wrt the robot reference frame
   */
   CColor cColor;
   CVector3 cStart, cEnd;
   /* Parse arguments */
   int64_t argn = buzzvm_lnum(vm);
   if(argn == 6) {
      /* Parse color */
      buzzvm_lload(vm, 1); /* red */
      buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
      buzzvm_lload(vm, 2); /* green */
      buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
      buzzvm_lload(vm, 3); /* blue */
      buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
      cColor.Set(buzzvm_stack_at(vm, 3)->i.value,
                 buzzvm_stack_at(vm, 2)->i.value,
                 buzzvm_stack_at(vm, 1)->i.value);
      /* Parse end vector */
      buzzvm_lload(vm, 4); /* x */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      buzzvm_lload(vm, 5); /* y */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      buzzvm_lload(vm, 6); /* z */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      cEnd.Set(buzzvm_stack_at(vm, 3)->f.value,
               buzzvm_stack_at(vm, 2)->f.value,
               buzzvm_stack_at(vm, 1)->f.value);
   }
   else if(argn == 9) {
      /* Parse color */
      buzzvm_lload(vm, 1); /* red */
      buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
      buzzvm_lload(vm, 2); /* green */
      buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
      buzzvm_lload(vm, 3); /* blue */
      buzzvm_type_assert(vm, 1, BUZZTYPE_INT);
      cColor.Set(buzzvm_stack_at(vm, 3)->i.value,
                 buzzvm_stack_at(vm, 2)->i.value,
                 buzzvm_stack_at(vm, 1)->i.value);
      /* Parse start vector */
      buzzvm_lload(vm, 4); /* x */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      buzzvm_lload(vm, 5); /* y */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      buzzvm_lload(vm, 6); /* z */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      cStart.Set(buzzvm_stack_at(vm, 3)->f.value,
                 buzzvm_stack_at(vm, 2)->f.value,
                 buzzvm_stack_at(vm, 1)->f.value);
      /* Parse end vector */
      buzzvm_lload(vm, 7); /* x */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      buzzvm_lload(vm, 8); /* y */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      buzzvm_lload(vm, 9); /* z */
      buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT);
      cEnd.Set(buzzvm_stack_at(vm, 3)->f.value,
               buzzvm_stack_at(vm, 2)->f.value,
               buzzvm_stack_at(vm, 1)->f.value);
   }
   else {
      /* Bomb out */
      buzzvm_seterror(vm, BUZZVM_ERROR_LNUM, "expected 6 or 9 arguments, but %" PRId64 " were passed", buzzvm_lnum(vm));
   }
   /* Get pointer to controller user data */
   buzzvm_pushs(vm, buzzvm_string_register(vm, "controller", 1));
   buzzvm_gload(vm);
   buzzvm_type_assert(vm, 1, BUZZTYPE_USERDATA);
   CBuzzController& cContr = *reinterpret_cast<CBuzzController*>(buzzvm_stack_at(vm, 1)->u.value);
   /* Call method */
   cContr.GetARGoSDebugInfo().RayAdd(cColor, cStart, cEnd);
   return buzzvm_ret0(vm);
}
开发者ID:isvogor-foi,项目名称:BuzzExt,代码行数:81,代码来源:buzz_controller.cpp


注:本文中的CColor::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。