本文整理汇总了C++中VEC3函数的典型用法代码示例。如果您正苦于以下问题:C++ VEC3函数的具体用法?C++ VEC3怎么用?C++ VEC3使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VEC3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateAABBOX
void CreateAABBOX(BOX& _out, const MATRIX& _mat)
{
VEC3 v1, v2;
D3DXVec3TransformCoord(&v1, &VEC3(-2,-2,-2), &_mat);
D3DXVec3TransformCoord(&v2, &VEC3(2,2,2), &_mat);
_out.Create(v1, v2);
}
示例2: SVertex
//------------------------------------------------------------------------------------
Mesh* SceneManager::CreatePlaneMesh( float w, float h )
{
float halfW = w / 2;
float halfH = h / 2;
SVertex vert[4] =
{
SVertex(VEC3(-w,0,+h), VEC2(0,0), VEC3::UNIT_Y),
SVertex(VEC3(+w,0,+h), VEC2(1,0), VEC3::UNIT_Y),
SVertex(VEC3(+w,0,-h), VEC2(1,1), VEC3::UNIT_Y),
SVertex(VEC3(-w,0,-h), VEC2(0,1), VEC3::UNIT_Y),
};
DWORD dwIndex[6] = {0,1,3,1,2,3};
Mesh* pMesh = new Mesh;
SubMesh* pSubmesh = new SubMesh;
pSubmesh->InitVertData(eVertexType_General, vert, 4, true);
pSubmesh->InitIndexData(dwIndex, 6, true);
pMesh->AddSubMesh(pSubmesh);
return pMesh;
}
示例3: VEC3
SimpleGMap2::SimpleGMap2()
{
position = myMap.addAttribute<VEC3, VERTEX, MAP>("position");
Dart d = Algo::Surface::Modelisation::createTetrahedron<PFP>(myMap);
position[d] = VEC3(0,0,0);
position[myMap.phi1(d)] = VEC3(10,0,15);
position[myMap.phi_1(d)] = VEC3(10,20,15);
position[myMap.phi_1(myMap.phi2(d))] = VEC3(0,0,30);
VEC3 mid = (position[d] + position[myMap.phi1(d)]) / 2.0f;
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid;
Algo::Surface::Tilings::Square::Cylinder<PFP> poly(myMap, 5 ,1, false, false);
d = poly.getDart();
poly.embedIntoCylinder(position, 10, 10, 5);
d = myMap.phi1(d);
Dart dd = myMap.beta2(d);
myMap.unsewFaces(d);
myMap.sewFaces(d, dd);
position[d][1] += 3.0f;
}
示例4: CSKIN_MESH
//================================================================================
//! メソッド名 CYAMAKAGE_WEAPON::コンストラクタ
//
// 引数 inDev Direct3Dデバイス
// inKind ボールの種類
// 更新 2009/02/17 <新規>
//================================================================================
CYAMAKAGE_WEAPON::CYAMAKAGE_WEAPON(CONST DEV inDev) :
CSKIN_MESH(inDev, NAME_YAMAKAGE_WEAPON)
{
// 属性の初期化
this->player = NULL;
this->viewG = NULL;
this->stageG = NULL;
this->weaponAction = eOPEYW_MAX;
this->iSmokeFrame = 0;
this->iMoveFrame = 0;
this->targetLoc = VEC3(0.0f, 0.0f, 0.0f);
this->ssEnemyBallShot = new SSTATIC("shot_shadow");
// オリジナル「エネミーボール」の生成
this->originEnemyBall
= new CENEMY_BALL(inDev, eENEMYB_STRAIGHT, "shadow_ball", EFFECT_SHADOW);
this->originEnemyBall->setEffectColor(D3DCOLOR_RGBA(100,100,100,255));
this->originEnemyBall->setReactMessage(eREAMSG_ENEMY_ATTACK_LV1);
// エフェクトの登録
C3D_EFFECT_CENTER* effectCenter = C3D_EFFECT_CENTER::getInstance();
effectCenter->addEffects(
EFFECT_SMOKE, new C3D_EFFECT(inDev, EFFECT_SMOKE, VEC3(0.0f,0.0f,0.0f)));
// 浮遊中に変更
this->setWeaponAction(eOPEYW_FLOATING);
// アニメーションの初期化
this->changeAnimationAndBlend(0);
// オブジェクトの種類を見える影に変更
this->setThisMessage(eTMSG_SEE_SHADOW);
}
示例5: quat_vector_vector
void quat_vector_vector(quat_t *q, const vec3_t *a, const vec3_t *b)
{
float cost = vec3_dot(a, b);
if (cost > 0.99999f) {
/* parallel */
*q = QUAT_IDENT;
} else if (cost < -0.99999f) {
/* opposite */
vec3_t t = VEC3(0, a->x, -a->y); /* cross with (1,0,0) */
if (vec3_magnitude(&t) < EPSILON)
t = VEC3(-a->z, 0, a->x); /* nope, use (0,1,0) */
vec3_normalize(&t);
q->v = t;
q->w = 0.f;
} else {
vec3_t t;
vec3_cross(&t, a, b);
vec3_normalize(&t);
/* sin^2 t = (1 - cos(2t)) / 2 */
float ss = sqrt(.5f * (1.f - cost));
vec3_scale(&t, ss);
q->v = t;
/* cos^2 t = (1 + cos(2t) / 2 */
q->w = sqrt(.5f * (1.f + cost));
}
}
示例6: PROPERTY_REG
bool PropertyPaneEffect::_OnCreate()
{
CXTPPropertyGridItem* pCategory = m_wndPropertyGrid.AddCategory(L"Shadow");
PROPERTY_REG(pCategory, Double , L"Far Distance" , 300 , propShadowFarDist);
PROPERTY_REG(pCategory, Double , L"Split Padding" , 1 , propShadowSplitPadding);
PROPERTY_REG(pCategory, Vec3 , L"Optimal Adjust Factor" , VEC3(0.5f,0.8f,2) , propShadowOptimalAdjustFactor);
PROPERTY_REG(pCategory, Bool , L"Use Simple Optimal Adjust" , TRUE , propShadowUseSimpleOptimalAdjust);
PROPERTY_REG(pCategory, Number , L"Camera Light Direction Threshold", 45 , propShadowCameraLightDirectionThreshold);
PROPERTY_REG(pCategory, Vec3 , L"Shadow Map Size" , VEC3(2048,1024,1024) , propShadowMapSize);
PROPERTY_REG(pCategory, Bool , L"Self Shadow" , FALSE , propShadowSelfShadow);
PROPERTY_REG(pCategory, Bool , L"Render Back Faces" , TRUE , propShadowCasterRenderBackFaces);
PROPERTY_REG(pCategory, Double , L"Lambda" , 0.75f , propShadowLambda);
PROPERTY_REG(pCategory, Double , L"Extrusion Distance" , 10000 , propShadowDirectionalLightExtrusionDistance);
pCategory->Expand();
pCategory = m_wndPropertyGrid.AddCategory(L"SSAO");
PROPERTY_REG(pCategory, Double , L"Sample Length" , 20 , propSSAOSampleLength);
PROPERTY_REG(pCategory, Double , L"Offset Scale" , 1 , propSSAOOffsetScale);
PROPERTY_REG(pCategory, Double , L"Default Accessibility" , 0.5f , propSSAODefaultAccessibility);
PROPERTY_REG(pCategory, Double , L"Edge Highlight" , 1.99f , propSSAOEdgeHighlight);
pCategory->Expand();
(dynamic_cast<CXTPPropertyGridItemVec3*>(m_mapItem[propShadowOptimalAdjustFactor]))->SetChildItemID(propOptimalAdjustFactor0, propOptimalAdjustFactor1, propOptimalAdjustFactor2);
(dynamic_cast<CXTPPropertyGridItemVec3*>(m_mapItem[propShadowMapSize]))->SetChildItemID(propShadowMapSize0, propShadowMapSize1, propShadowMapSize2);
return true;
}
示例7: VEC3
SimpleGMap2::SimpleGMap2()
{
position = myMap.addAttribute<VEC3, VERTEX>("position");
Dart d = Algo::Modelisation::createTetrahedron<PFP>(myMap);
position[d] = VEC3(0,0,0);
position[myMap.phi1(d)] = VEC3(10,0,15);
position[myMap.phi_1(d)] = VEC3(10,20,15);
position[myMap.phi_1(myMap.phi2(d))] = VEC3(0,0,30);
VEC3 mid = (position[d] + position[myMap.phi1(d)]) / 2.0f;
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid;
Algo::Modelisation::Polyhedron<PFP> poly(myMap, position);
d = poly.cylinder_topo(5, 1, false, false);
poly.embedCylinder(10, 10, 5);
d = myMap.phi1(d);
Dart dd = myMap.beta2(d);
myMap.unsewFaces(d);
myMap.sewFaces(d, dd);
position[d][1] += 3.0f;
}
示例8: V
//=================================================================================================
void CreateCharacterPanel::RenderUnit()
{
// rysuj obrazek
HRESULT hr = game->device->TestCooperativeLevel();
if(hr != D3D_OK)
return;
game->SetAlphaBlend(false);
game->SetAlphaTest(false);
game->SetNoCulling(false);
game->SetNoZWrite(false);
// ustaw render target
SURFACE surf = NULL;
if(game->sChar)
V( game->device->SetRenderTarget(0, game->sChar) );
else
{
V( game->tChar->GetSurfaceLevel(0, &surf) );
V( game->device->SetRenderTarget(0, surf) );
}
// pocz¹tek renderowania
V( game->device->Clear(0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, 0, 1.f, 0) );
V( game->device->BeginScene() );
static vector<Lights> lights;
game->SetOutsideParams();
MATRIX matView, matProj;
D3DXMatrixLookAtLH(&matView, &VEC3(0.f,2.f,dist), &VEC3(0.f,1.f,0.f), &VEC3(0,1,0));
D3DXMatrixPerspectiveFovLH(&matProj, PI/4, 0.5f, 1.f, 5.f);
game->tmp_matViewProj = matView * matProj;
D3DXMatrixInverse(&game->tmp_matViewInv, NULL, &matView);
game->camera_frustum.Set(game->tmp_matViewProj);
game->ListDrawObjectsUnit(NULL, game->camera_frustum, true, *unit);
game->DrawSceneNodes(game->draw_batch.nodes, lights, true);
game->draw_batch.Clear();
// koniec renderowania
V( game->device->EndScene() );
// kopiuj jeœli jest mipmaping
if(game->sChar)
{
V( game->tChar->GetSurfaceLevel(0, &surf) );
V( game->device->StretchRect(game->sChar, NULL, surf, NULL, D3DTEXF_NONE) );
}
surf->Release();
// przywróc poprzedni render target
V( game->device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &surf) );
V( game->device->SetRenderTarget(0, surf) );
surf->Release();
}
示例9: goursat
float goursat(vec3 p, vec3 mods)
{
vec3 res;
float p2;
p2 = sum(pow(p, VEC3(2)));
return (-(sum(pow(p, VEC3(4))) + mods.x * pow(p2, 2) +
mods.y * p2 + mods.z));
}
示例10: StorageChunk
StorageChunk StorageChunk::new_from_buffer(const Vec3i &location,
const Vector<uint8_t> &contents, Error *err)
{
if (contents.length() < 4 || slice_cast<const char>(contents.sub(0, 4)) != "NGSC") {
err->set("Bad magic, NGSC expected");
return StorageChunk(location);
}
ByteReader br(contents.sub(4));
Vec3i chunk_size, storage_chunk_size;
chunk_size.x = br.read_int32(err);
chunk_size.y = br.read_int32(err);
chunk_size.z = br.read_int32(err);
if (*err)
return StorageChunk(location);
if (chunk_size != CHUNK_SIZE) {
err->set("Mismatching chunk sizes, file: (%d %d %d), expected: (%d %d %d)",
VEC3(chunk_size), VEC3(CHUNK_SIZE));
return StorageChunk(location);
}
storage_chunk_size.x = br.read_int32(err);
storage_chunk_size.y = br.read_int32(err);
storage_chunk_size.z = br.read_int32(err);
if (*err)
return StorageChunk(location);
if (storage_chunk_size != STORAGE_CHUNK_SIZE) {
err->set("Mismatching storage chunk sizes, file: (%d %d %d), expected: (%d %d %d)",
VEC3(storage_chunk_size), VEC3(STORAGE_CHUNK_SIZE));
return StorageChunk(location);
}
auto tmp = br.read_compressed(err);
if (*err)
return StorageChunk(location);
StorageChunk msc(location);
br = ByteReader(tmp);
for (int i = 0, n = volume(storage_chunk_size); i < n; i++) {
Chunk &c = msc.chunks[i];
c.lods[0].deserialize(&br, CHUNK_SIZE + Vec3i(1), err);
if (*err)
return StorageChunk(location);
}
return msc;
}
示例11: vec3_majoraxis
void vec3_majoraxis(vec3_t *out, const vec3_t *v)
{
float x, y, z;
x = fabsf(v->x);
y = fabsf(v->y);
z = fabsf(v->z);
if (x > y && x > z)
*out = VEC3(v->x < 0 ? -1 : 1, 0, 0);
else if (y > x && y > z)
*out = VEC3(0, v->y < 0 ? -1 : 1, 0);
else
*out = VEC3(0, 0, v->z < 0 ? -1 : 1);
}
示例12: CKAGETOKI_ADVENT_ENEMY
//================================================================================
//! メソッド名 CENEMY_SHADOG::コンストラクタ
//
// 引数 inDev Direct3Dデバイス
// inName Xファイルの名称
// inResource メッシュフォルダ名
// inTexture テクスチャフォルダ名
// 更新 2009/01/19 <新規>
//================================================================================
CENEMY_SHADOG::CENEMY_SHADOG( CONST DEV inDev,
CONST LPSTR inName,
CONST LPSTR inResource,
CONST LPSTR inTexture) :
CKAGETOKI_ADVENT_ENEMY(inDev, inName, inResource, inTexture)
{
// 属性の初期化
this->fFloorSpace = 15.0f; //!< 床との間隔
this->fWallSpace = 10.0f; //!< 壁との間隔
this->fJumpHeight = 50.0f; //!< ジャンプ力
// アニメーションの割り当てを行う
this->iAnimTemp[eESHADOGA_WAIT] = 0;
this->iAnimTemp[eESHADOGA_RUN] = 1;
this->iAnimTemp[eESHADOGA_JUMP] = 2;
this->iAnimTemp[eESHADOGA_ATTACK] = 3;
this->iMaxLife = 2; //!< 最大体力
this->iLife = this->iMaxLife; //!< 残り体力
this->iHitFrame = 0; //!< 衝突して点滅する時間
// フラグ群
this->action = eESHADOGA_MAX; //!< 最初は待機以外何でも良い
this->changeAction(eESHADOGA_WAIT); //!< 初期状態は出現
this->setThisMessage(eTMSG_ENEMY); //!< 敵表示
this->stepCnt = 0;
// 音のセット
this->sStaticStep = new SSTATIC(SOUND_STEP);
this->sStaticJumpStart = new SSTATIC(SOUND_JUMP_START);
this->sStaticJumpEnd = new SSTATIC(SOUND_JUMP_START);
this->sStaticBark1 = new SSTATIC(SOUND_BARK1);
this->sStaticBark2 = new SSTATIC(SOUND_BARK2);
this->sStaticStep->setVolume(-1500);
this->sStaticJumpStart->setVolume(-1500);
this->sStaticJumpEnd->setVolume(-1500);
this->sStaticBark1->setVolume(-1000);
this->sStaticBark2->setVolume(-1000);
// エフェクトの登録
C3D_EFFECT_CENTER* effectCenter = C3D_EFFECT_CENTER::getInstance();
effectCenter->addEffects(
EFFECT_SMOKE, new C3D_EFFECT(inDev, EFFECT_SMOKE, VEC3(0.0f,0.0f,0.0f)));
// ローカル座標の変更
this->sd_ptr->mesh->localCenter = VEC3(0.0f, 50.0f, 0.0f);
this->sd_ptr->mesh->localRadius = 100.0f;
}
示例13: SVertex
//----------------------------------------------------------------------------------------
D3D11RenderTarget::D3D11RenderTarget()
:m_pRenderSystem(g_env.pRenderSystem)
,m_pRenderTexture(nullptr)
,m_clearColor(SColor::BLACK)
,m_bClearColor(true)
,m_bClearZBuffer(true)
,m_bHasDepthBuffer(false)
,m_bNoFrameBuffer(false)
,m_bUpdateRatioAspect(true)
,m_phaseFlag(eRenderPhase_Geometry)
,m_pDepthStencil(nullptr)
,m_sizeRatio(0, 0)
{
// Create screen quad
static bool bCreate = false;
if (!bCreate)
{
m_pQuadMesh = new Mesh;
SubMesh* pSubMesh = new SubMesh;
SVertex v[4] =
{
SVertex(VEC3(-1,1,0), VEC2(0,0)),
SVertex(VEC3(1,1,0), VEC2(1,0)),
SVertex(VEC3(-1,-1,0), VEC2(0,1)),
SVertex(VEC3(1,-1,0), VEC2(1,1))
};
DWORD index[6] = { 0,1,2, 1,3,2 };
// Store index to frustum far corner
v[0].normal.x = 0;
v[1].normal.x = 1;
v[2].normal.x = 2;
v[3].normal.x = 3;
pSubMesh->InitVertData(eVertexType_General, v, ARRAYSIZE(v), true);
pSubMesh->InitIndexData(index, ARRAYSIZE(index), true);
m_pQuadMesh->AddSubMesh(pSubMesh);
m_pQuadEntity = new Entity(m_pQuadMesh);
m_pQuadEntity->SetCastShadow(false);
m_pQuadEntity->SetReceiveShadow(false);
bCreate = true;
}
}
示例14: CMESH
//================================================================================
//! メソッド名 CKAGEO_BALL::コンストラクタ
//
// 引数 inDev Direct3Dデバイス
// inKind ボールの種類
// 更新 2008/08/26 <新規>
//================================================================================
CKAGEO_BALL::CKAGEO_BALL(CONST DEV inDev,
KAGEO_BALL_KIND inKind) :
CMESH(inDev, getBallTextureName(inKind))
{
// 属性の初期化
this->activate = FALSE;
this->hitG = NULL;
this->iFrame = 0;
this->sStaticHit = NULL;
// ボールの種類により、初期化処理分岐
switch(inKind)
{
// シャドウボール
case eKOBALL_SHADOW:
// 見えない影を、見える影にするメッセージ
this->judgMessage = eTMSG_NO_SEE_SHADOW;
this->reactMessage = eREAMSG_SHADOW_HIT;
this->setThisMessage(eTMSG_SHADOW_BALL);
// エフェクト関連
this->iEffectCnt = 3;
strcpy_s(this->effectName, sizeof(effectName), EFFECT_SHADOW);
// 煙の色
this->smokeColor = D3DCOLOR_RGBA(10, 10, 10, 255);
// 音を生成
this->sStaticHit = new SSTATIC(SOUND_SHADOWB_HIT);
break;
// シャインボール
case eKOBALL_SHINE:
// 見える影を、見えない影にするメッセージ
this->judgMessage = eTMSG_SEE_SHADOW;
this->reactMessage = eREAMSG_SHINE_HIT;
this->setThisMessage(eTMSG_SHINE_BALL);
// エフェクト関連
this->iEffectCnt = 3;
strcpy_s(this->effectName, sizeof(effectName), EFFECT_SHINE);
// 音を生成
this->sStaticHit = new SSTATIC(SOUND_SHINEB_HIT);
// 煙の色
this->smokeColor = D3DCOLOR_RGBA(255, 255, 200, 255);
break;
// 上記以外(エラー数値)
default:
this->judgMessage = eTMSG_NOMSG;
this->reactMessage = eREAMSG_NOMSG;
this->setThisMessage(eTMSG_NOMSG);
this->iEffectCnt = 100000;
strcpy_s(this->effectName, sizeof(effectName), "");
this->smokeColor = D3DCOLOR_RGBA(255, 255, 255, 255);
return;
}
// エフェクトの登録
C3D_EFFECT_CENTER* effectCenter = C3D_EFFECT_CENTER::getInstance();
effectCenter->addEffects(
this->effectName,
new C3D_EFFECT(inDev, this->effectName, VEC3(0.0f,0.0f,0.0f)));
}
示例15: get_texture
s_texmod get_texture(s_mat mat, vec3 pos, vec3 normal)
{
int val;
vec3 tmp;
vec4 v;
tmp = pos / mat.m_param.xyz;
if (mat.m_id == CHECKBOARD)
{
if (INT(floor(tmp.x) + floor(tmp.y) + floor(tmp.z)) % 2 == 1)
return (S_TEXMOD(mat.m_color, normal, mat.m_prop.x, mat.m_prop.y));
return (S_TEXMOD(mat.color, normal, mat.smoothness, mat.metallic));
}
if (mat.m_id == BUMP)
{
tmp = VEC3(sin(tmp.x), 0, cos(tmp.z));
v.x = length(tmp);
return (S_TEXMOD(mat.color, normalize(normal + mat.m_param.w * tmp),
mat.smoothness * v.x, mat.metallic * v.x));
}
if (mat.m_id == WAVE)
{
tmp = floor(tmp + sin(tmp.zyx));
if (INT(tmp.x + tmp.y + tmp.z) % 2 == 1)
return (S_TEXMOD(mat.m_color, normal, mat.m_prop.x, mat.m_prop.y));
}
return (get_texture2(mat, pos, normal));
}