这篇教程C++ vector3f函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vector3f函数的典型用法代码示例。如果您正苦于以下问题:C++ vector3f函数的具体用法?C++ vector3f怎么用?C++ vector3f使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vector3f函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PROFILE_SCOPEDvoid HudTrail::Render(Graphics::Renderer *r){ PROFILE_SCOPED(); //render trail if (m_trailPoints.size() > 1) { const vector3d vpos = m_transform * m_body->GetInterpPosition(); m_transform[12] = vpos.x; m_transform[13] = vpos.y; m_transform[14] = vpos.z; m_transform[15] = 1.0; static std::vector<vector3f> tvts; static std::vector<Color> colors; tvts.clear(); colors.clear(); const vector3d curpos = m_body->GetInterpPosition(); tvts.reserve(MAX_POINTS); colors.reserve(MAX_POINTS); tvts.push_back(vector3f(0.f)); colors.push_back(Color::BLANK); float alpha = 1.f; const float decrement = 1.f / m_trailPoints.size(); const Color tcolor = m_color; for (size_t i = m_trailPoints.size()-1; i > 0; i--) { tvts.push_back(-vector3f(curpos - m_trailPoints[i])); alpha -= decrement; colors.push_back(tcolor); colors.back().a = Uint8(alpha * 255); } r->SetTransform(m_transform); m_lines.SetData(tvts.size(), &tvts[0], &colors[0]); m_lines.Draw(r, m_renderState, Graphics::LINE_STRIP); }}
开发者ID:Action-Committee,项目名称:pioneer,代码行数:35,
示例2: Initvoid BallsView::Init(){ camera.Init(); camera.SwitchCamMode(true); camera.MoveA(vector3f(0,0,0)); camera.RotateA(vector3f(0,M_PI/4,0)); camera.ZoomR(-3);}
开发者ID:BetaRavener,项目名称:Unishader-demo,代码行数:7,
示例3: LmrGetLuaState/* when ship is on rails it returns true and fills outPosOrient. * when ship has been released (or docked) it returns false. * Note station animations may continue for any number of stages after * ship has been released and is under player control again */bool SpaceStationType::GetDockAnimPositionOrient(int port, int stage, double t, const vector3d &from, positionOrient_t &outPosOrient, const Ship *ship) const{ if ((stage < 0) && ((-stage) > numUndockStages)) return false; if ((stage > 0) && (stage > numDockingStages)) return false; lua_State *L = LmrGetLuaState(); LUA_DEBUG_START(L); lua_pushcfunction(L, pi_lua_panic); // It's a function of form function(stage, t, from) model->PushAttributeToLuaStack("ship_dock_anim"); if (!lua_isfunction(L, -1)) { Error("Spacestation model %s needs ship_dock_anim method", model->GetName()); } lua_pushinteger(L, port+1); lua_pushinteger(L, stage); lua_pushnumber(L, double(t)); vector3f *_from = MyLuaVec::pushVec(L); *_from = vector3f(from); // push model aabb as lua table: { min: vec3, max: vec3 } { Aabb aabb; ship->GetAabb(aabb); lua_createtable (L, 0, 2); vector3f *v = MyLuaVec::pushVec(L); *v = vector3f(aabb.max); lua_setfield(L, -2, "max"); v = MyLuaVec::pushVec(L); *v = vector3f(aabb.min); lua_setfield(L, -2, "min"); } lua_pcall(L, 5, 1, -7); bool gotOrient; if (lua_istable(L, -1)) { gotOrient = true; lua_pushinteger(L, 1); lua_gettable(L, -2); outPosOrient.pos = vector3d(*MyLuaVec::checkVec(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 2); lua_gettable(L, -2); outPosOrient.xaxis = vector3d(*MyLuaVec::checkVec(L, -1)); lua_pop(L, 1); lua_pushinteger(L, 3); lua_gettable(L, -2); outPosOrient.yaxis = vector3d(*MyLuaVec::checkVec(L, -1)); lua_pop(L, 1); } else { gotOrient = false; } lua_pop(L, 2); LUA_DEBUG_END(L, 0); return gotOrient;}
开发者ID:Sunsetjoy,项目名称:pioneer,代码行数:64,
示例4: GetActiveOffsetvoid Face::Draw(){ const Point &offset = GetActiveOffset(); const Point &area = GetActiveArea(); const float x = offset.x; const float y = offset.y; const float sx = area.x; const float sy = area.y; const vector2f texSize = m_texture->GetDescriptor().texSize; Graphics::VertexArray va(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_UV0); va.Add(vector3f(x, y, 0.0f), vector2f(0.0f, 0.0f)); va.Add(vector3f(x, y+sy, 0.0f), vector2f(0.0f, texSize.y)); va.Add(vector3f(x+sx, y, 0.0f), vector2f(texSize.x, 0.0f)); va.Add(vector3f(x+sx, y+sy, 0.0f), vector2f(texSize.x, texSize.y)); Graphics::Renderer *r = GetContext()->GetRenderer(); s_material->texture0 = m_texture.get(); auto state = GetContext()->GetSkin().GetAlphaBlendState(); r->DrawTriangles(&va, state, s_material.Get(), Graphics::TRIANGLE_STRIP); Single::Draw();}
开发者ID:ZeframCochrane,项目名称:pioneer,代码行数:25,
示例5: void ObjectViewerView::Draw3D(){ m_renderer->ClearScreen(); float znear, zfar; m_renderer->GetNearFarRange(znear, zfar); m_renderer->SetPerspectiveProjection(75.f, Pi::GetScrAspect(), znear, zfar); m_renderer->SetTransform(matrix4x4f::Identity()); Graphics::Light light; light.SetType(Graphics::Light::LIGHT_DIRECTIONAL); if (Pi::MouseButtonState(SDL_BUTTON_RIGHT)) { int m[2]; Pi::GetMouseMotion(m); m_camRot = matrix4x4d::RotateXMatrix(-0.002*m[1]) * matrix4x4d::RotateYMatrix(-0.002*m[0]) * m_camRot; } Body *body = Pi::player->GetNavTarget(); if (body) { if (body->IsType(Object::STAR)) light.SetPosition(vector3f(0.f)); else { light.SetPosition(vector3f(0.577f)); } m_renderer->SetLights(1, &light); body->Render(m_renderer, 0, vector3d(0,0,-viewingDist), m_camRot); }}
开发者ID:gamebytes,项目名称:pioneer,代码行数:30,
示例6: GetContextvoid Face::Draw(){ Graphics::Renderer *r = GetContext()->GetRenderer(); if (!m_quad) { const Point &offset = GetActiveOffset(); const Point &area = GetActiveArea(); const float x = offset.x; const float y = offset.y; const float sx = area.x; const float sy = area.y; const vector2f texSize = m_texture->GetDescriptor().texSize; Graphics::VertexArray va(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_UV0); va.Add(vector3f(x, y, 0.0f), vector2f(0.0f, 0.0f)); va.Add(vector3f(x, y + sy, 0.0f), vector2f(0.0f, texSize.y)); va.Add(vector3f(x + sx, y, 0.0f), vector2f(texSize.x, 0.0f)); va.Add(vector3f(x + sx, y + sy, 0.0f), vector2f(texSize.x, texSize.y)); Graphics::Renderer *r = GetContext()->GetRenderer(); s_material->texture0 = m_texture.get(); auto state = GetContext()->GetSkin().GetAlphaBlendState(); m_quad.reset(new Graphics::Drawables::TexturedQuad(r, s_material, va, state)); } m_quad->Draw(r); Single::Draw();}
开发者ID:emptyhead,项目名称:pioneer,代码行数:29,
示例7: DrawRoundEdgedRect void DrawRoundEdgedRect(const float size[2], float rad, const Color &color, Graphics::RenderState *state) { static Graphics::VertexArray vts(Graphics::ATTRIB_POSITION); vts.Clear(); const int STEPS = 6; if (rad > 0.5f*std::min(size[0], size[1])) rad = 0.5f*std::min(size[0], size[1]); // top left // bottom left for (int i=0; i<=STEPS; i++) { float ang = M_PI*0.5f*i/float(STEPS); vts.Add(vector3f(rad - rad*cos(ang), (size[1] - rad) + rad*sin(ang), 0.f)); } // bottom right for (int i=0; i<=STEPS; i++) { float ang = M_PI*0.5 + M_PI*0.5f*i/float(STEPS); vts.Add(vector3f(size[0] - rad - rad*cos(ang), (size[1] - rad) + rad*sin(ang), 0.f)); } // top right for (int i=0; i<=STEPS; i++) { float ang = M_PI + M_PI*0.5f*i/float(STEPS); vts.Add(vector3f((size[0] - rad) - rad*cos(ang), rad + rad*sin(ang), 0.f)); } // top right for (int i=0; i<=STEPS; i++) { float ang = M_PI*1.5 + M_PI*0.5f*i/float(STEPS); vts.Add(vector3f(rad - rad*cos(ang), rad + rad*sin(ang), 0.f)); } Screen::flatColorMaterial->diffuse = color; Screen::GetRenderer()->DrawTriangles(&vts, state, Screen::flatColorMaterial, Graphics::TRIANGLE_FAN); }
开发者ID:ZeframCochrane,项目名称:pioneer,代码行数:33,
示例8: atan2void moon::display(const vector3 &moon_pos, const vector3 &sun_pos, double max_view_dist) const{ vector3 moon_dir = moon_pos.normal(); double moon_size = max_view_dist/20; float moon_azimuth = atan2(-moon_dir.y, moon_dir.x); float moon_elevation = asin(moon_dir.z); glsl_moon->use(); glsl_moon->set_gl_texture(*map_diffuse, loc_diffcol, 0); glsl_moon->set_gl_texture(*map_normal, loc_nrml, 1); // transform light into object space matrix4 roth = matrix4::rot_z(-RAD_TO_DEG(moon_azimuth)); matrix4 rotv = matrix4::rot_y(-RAD_TO_DEG(moon_elevation)); matrix4 model_mat = roth*rotv; vector3 l = model_mat.inverse() * sun_pos; vector3 nl = vector3(-l.y, l.z, -l.x).normal(); // OpenGL coordinates glsl_moon->set_uniform(loc_lightdir, nl); // render moon glPushMatrix(); model_mat.multiply_gl(); glTranslated(0.95*max_view_dist, 0, 0); primitives::textured_quad(vector3f( 0, moon_size, moon_size), vector3f( 0, -moon_size, moon_size), vector3f( 0, -moon_size, -moon_size), vector3f( 0, moon_size, -moon_size), *map_diffuse).render_plain(); glPopMatrix();}
开发者ID:salamanderrake,项目名称:dangerdeep,代码行数:30,
示例9: GetRenderervoid Billboard::Render(const matrix4x4f &trans, const RenderData *rd){ Graphics::Renderer *r = GetRenderer(); Graphics::VertexArray va(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_UV0, 6); const matrix3x3f rot = trans.GetOrient().Transpose(); //some hand-tweaked scaling, to make the lights seem larger from distance const float size = m_size * Graphics::GetFovFactor() * Clamp(trans.GetTranslate().Length() / 500.f, 0.25f, 15.f); const vector3f rotv1 = rot * vector3f(size/2.f, -size/2.f, 0.0f); const vector3f rotv2 = rot * vector3f(size/2.f, size/2.f, 0.0f); va.Add(m_offset-rotv1, vector2f(0.f, 0.f)); //top left va.Add(m_offset-rotv2, vector2f(0.f, 1.f)); //bottom left va.Add(m_offset+rotv2, vector2f(1.f, 0.f)); //top right va.Add(m_offset+rotv2, vector2f(1.f, 0.f)); //top right va.Add(m_offset-rotv2, vector2f(0.f, 1.f)); //bottom left va.Add(m_offset+rotv1, vector2f(1.f, 1.f)); //bottom right r->SetTransform(trans); r->DrawTriangles(&va, m_renderState, m_material.Get());}
开发者ID:AmesianX,项目名称:pioneer,代码行数:25,
示例10: m_isMaked //------------------------------------------------------------------------------------------------------ RotatingRing::RotatingRing() :LocatableObject( this ), m_isMaked(false), m_pRingBuffer(NULL), m_fRadius(0) { float bs = 1.5 * 1; m_BindBox = aabbox3df( vector3f( -bs, -bs, -bs ), vector3f( bs, bs, bs ) ); m_isMaked = true; m_fRadius = 1; ASSERT( 3 == RC_AXIS ); VertexColor LineVertex[ RC_AXIS * RC_POINT ]; static ushort Indies[RC_AXIS*RC_POINT*2]; for ( int i = 0 ; i < RC_AXIS*RC_POINT*2; i += 2 ) { Indies[i] = i/2; //Indies[i+1] = (i/2)%RC_POINT==0&&0!=i ? i-RC_POINT*2 : i/2+1 ; if ( i/2 == RC_POINT-1 || i/2 == RC_POINT*2-1 || i/2 == RC_POINT*3-1 ) { Indies[i+1] = i/2-RC_POINT+1; } else { Indies[i+1] = i/2+1; } } m_pRingBuffer = NEW RendBuffer( Device::RM_LINES ); m_pVertexBuffer = NEW VertexBuffer( Device::MU_DYNAMIC ); m_pIndicesBuffer = NEW IndicesBuffer( Device::MU_STATIC ); m_pRingBuffer->SetVertexBuffer( m_pVertexBuffer ); m_pRingBuffer->SetIndicesBuffer( m_pIndicesBuffer ); m_pIndicesBuffer->FlushIndiesBuffer( RC_AXIS*RC_POINT*2, Indies ); }
开发者ID:ServerGame,项目名称:Bohge_Engine,代码行数:34,
示例11: aabbox3df //------------------------------------------------------------------------------------------------------ void RotatingRing::CreateRing( const float& r ) { float bs = 1.5 * r; m_BindBox = aabbox3df( vector3f( -bs, -bs, -bs ), vector3f( bs, bs, bs ) ); m_isMaked = true; m_fRadius = r; ASSERT( 3 == RC_AXIS ); VertexColor LineVertex[ RC_AXIS * RC_POINT ]; for ( int i = 0; i < RC_POINT; i ++ ) { Matrix22f m; m.FromRadian( (PI / 180) * i ); vector2f v( r, 0 ); v *= m; LineVertex[i].SetVertex( vector4f( v.m_x, 0, v.m_y, 1 ) );// C++ vector4函数代码示例 C++ vector3df函数代码示例
|