Ejemplo n.º 1
0
CCube::CCube(CTextureLibraray * texture)
{
	m_TextureLib = texture;
	m_Center.x = static_cast<float>((rand() % MapSize) - MapSize / 2);
	m_Center.y = 0.0f;
	m_Center.z = static_cast<float>((rand() % MapSize) - MapSize / 2);
	float l = sqrt(m_Center.x*m_Center.x + m_Center.z*m_Center.z);
	Vec3f vec = CalcNormalize(m_Center);
	if (l < 400.0f)
	{
		m_Center = 400.0f * vec;
	}
	m_scale.x = 50.0f + rand() % 150;
	m_scale.y = 500.0f + rand() % 350;
	m_scale.z = 50.0f + rand() % 150;
	for (int i = 0; i < 16; i++) m_matrix[i] = 0;
	for (int i = 0; i < 4; i++) m_matrix[i * 4 + i] = 1;
	m_Angle.pitch = 5 - rand() % 10;
	m_Angle.yaw = 45 - rand() % 90;
	m_Angle.roll =  5 - rand() % 10;
	Rotate(m_Angle.pitch, true, false, false);
	Rotate(m_Angle.yaw, false, true, false);
	Rotate(m_Angle.roll, false, false, true);
	RotateInit();
}
Ejemplo n.º 2
0
CCube::CCube()
{
	m_Center = { 0.0f , 0.0f , 0.0f };
	m_scale = { 20.0f, 20.0f, 20.0f };
	for (int i = 0; i < 16; i++) m_matrix[i] = 0;
	for (int i = 0; i < 4; i++) m_matrix[i * 4 + i] = 1;
	RotateInit();
}
Ejemplo n.º 3
0
void CCube::Scale(Vec3f scale)
{
	
	m_scale.x = scale.x;
	m_scale.y = scale.y;
	m_scale.z = scale.z;
	RotateInit();
}
Ejemplo n.º 4
0
void CCube::Translate(Vec3f move)
{
	m_Center += move;
	for (int i = 0; i < 8; i++)
	{
		m_Cube[i] += move;
	}
	RotateInit();
}
void MyModuleInit(RTC::Manager* manager)
{
  RotateInit(manager);
  RTC::RtcBase* comp;

  // Create a component
  comp = manager->createComponent("Rotate");

  if (comp==NULL)
  {
    std::cerr << "Component create failed." << std::endl;
    abort();
  }

  // Example
  // The following procedure is examples how handle RT-Components.
  // These should not be in this function.

  // Get the component's object reference
//  RTC::RTObject_var rtobj;
//  rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));

  // Get the port list of the component
//  PortServiceList* portlist;
//  portlist = rtobj->get_ports();

  // getting port profiles
//  std::cout << "Number of Ports: ";
//  std::cout << portlist->length() << std::endl << std::endl; 
//  for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
//  {
//    PortService_ptr port;
//    port = (*portlist)[i];
//    std::cout << "Port" << i << " (name): ";
//    std::cout << port->get_port_profile()->name << std::endl;
//    
//    RTC::PortInterfaceProfileList iflist;
//    iflist = port->get_port_profile()->interfaces;
//    std::cout << "---interfaces---" << std::endl;
//    for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
//    {
//      std::cout << "I/F name: ";
//      std::cout << iflist[i].instance_name << std::endl;
//      std::cout << "I/F type: ";
//      std::cout << iflist[i].type_name << std::endl;
//      const char* pol;
//      pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
//      std::cout << "Polarity: " << pol << std::endl;
//    }
//    std::cout << "---properties---" << std::endl;
//    NVUtil::dump(port->get_port_profile()->properties);
//    std::cout << "----------------" << std::endl << std::endl;
//  }

  return;
}
Ejemplo n.º 6
0
void CCube::Rotate(float angle, bool x, bool y, bool z)
{
	glPushMatrix();
	glLoadIdentity();
	if (x) glRotatef(angle, 1.0f, 0.0f, 0.0f);
	if (y) glRotatef(angle, 0.0f, 1.0f, 0.0f);
	if (z) glRotatef(angle, 0.0f, 0.0f, 1.0f);
	glMultMatrixf(m_matrix);
	glGetFloatv(GL_MODELVIEW_MATRIX, m_matrix);
	glPopMatrix();
	m_Angle.pitch += angle;
	m_Angle.yaw += angle;
	m_Angle.roll += angle;
	
	RotateInit();
}
Ejemplo n.º 7
0
void SkJS::InitializeDisplayables(const SkBitmap& bitmap, JSContext *cx, JSObject *obj, JSObject *proto) {
    SkJSDisplayable::gCanvas = new SkCanvas(bitmap);
    SkJSDisplayable::gPaint = new SkPaint();
#if SK_USE_CONDENSED_INFO == 0
    GenerateTables();
#else
    SkASSERT(0); // !!! compressed version hasn't been implemented
#endif
    AddInit(cx, obj, proto);
    AddCircleInit(cx, obj, proto);
    AddOvalInit(cx, obj, proto);
    AddPathInit(cx, obj, proto);
    AddRectangleInit(cx, obj, proto);
    AddRoundRectInit(cx, obj, proto);
//  AfterInit(cx, obj, proto);
    ApplyInit(cx, obj, proto);
    // AnimateInit(cx, obj, proto);
//  AnimateColorInit(cx, obj, proto);
    AnimateFieldInit(cx, obj, proto);
//  AnimateRotateInit(cx, obj, proto);
//  AnimateScaleInit(cx, obj, proto);
//  AnimateTranslateInit(cx, obj, proto);
    BitmapInit(cx, obj, proto);
//  BaseBitmapInit(cx, obj, proto);
//  BeforeInit(cx, obj, proto);
    BitmapShaderInit(cx, obj, proto);
    BlurInit(cx, obj, proto);
    ClipInit(cx, obj, proto);
    ColorInit(cx, obj, proto);
    CubicToInit(cx, obj, proto);
    DashInit(cx, obj, proto);
    DataInit(cx, obj, proto);
//  DimensionsInit(cx, obj, proto);
    DiscreteInit(cx, obj, proto);
    DrawToInit(cx, obj, proto);
    EmbossInit(cx, obj, proto);
    EventInit(cx, obj, proto);
//  FontInit(cx, obj, proto);
//  FocusInit(cx, obj, proto);
    ImageInit(cx, obj, proto);
    IncludeInit(cx, obj, proto);
//  InputInit(cx, obj, proto);
    LineInit(cx, obj, proto);
    LinearGradientInit(cx, obj, proto);
    LineToInit(cx, obj, proto);
    MatrixInit(cx, obj, proto);
    MoveInit(cx, obj, proto);
    MoveToInit(cx, obj, proto);
    OvalInit(cx, obj, proto);
    PathInit(cx, obj, proto);
    PaintInit(cx, obj, proto);
    DrawPointInit(cx, obj, proto);
    PolyToPolyInit(cx, obj, proto);
    PolygonInit(cx, obj, proto);
    PolylineInit(cx, obj, proto);
    PostInit(cx, obj, proto);
    QuadToInit(cx, obj, proto);
    RadialGradientInit(cx, obj, proto);
    RandomInit(cx, obj, proto);
    RectToRectInit(cx, obj, proto);
    RectangleInit(cx, obj, proto);
    RemoveInit(cx, obj, proto);
    ReplaceInit(cx, obj, proto);
    RotateInit(cx, obj, proto);
    RoundRectInit(cx, obj, proto);
    ScaleInit(cx, obj, proto);
    SetInit(cx, obj, proto);
    SkewInit(cx, obj, proto);
    // 3D_CameraInit(cx, obj, proto);
    // 3D_PatchInit(cx, obj, proto);
    SnapshotInit(cx, obj, proto);
//  StrokeInit(cx, obj, proto);
    TextInit(cx, obj, proto);
    TextOnPathInit(cx, obj, proto);
    TextToPathInit(cx, obj, proto);
    TranslateInit(cx, obj, proto);
//  UseInit(cx, obj, proto);
}
Ejemplo n.º 8
0
void CCube::SetPos(Vec3f & pos)
{
	m_Center = pos;
	RotateInit();
}