//------------------------------------------------------------------------------ // コンストラクタ //------------------------------------------------------------------------------ // 引数 // なし //------------------------------------------------------------------------------ CBullet::CBullet():CBillboard() { // 速度 Movement = VECTOR3(0.0f, 0.0f, 0.0f); // テクスチャ Texture = CTexture::Texture(TEX_BULLET); SetUV(0,0,1.0f,1.0f); }
RudeSkybox::RudeSkybox() { const float scale = 150.0f; const bool adjustUV = true; const int textureSize = 512; float *Vertices = m_verts; float *UVs = m_uvs; float unit = 1.0f; float a0 = 0, a1 = unit; if (adjustUV) { float oneover = 1.0f / textureSize; a0 = 1.0f * oneover; a1 = unit - a0; } // Front SetVertex(Vertices, 0, -unit, +unit, -unit); SetVertex(Vertices, 1, +unit, +unit, -unit); SetVertex(Vertices, 2, -unit, -unit, -unit); SetVertex(Vertices, 3, +unit, -unit, -unit); SetUV(UVs, 0, a0, a1); SetUV(UVs, 1, a1, a1); SetUV(UVs, 2, a0, a0); SetUV(UVs, 3, a1, a0); // Right SetVertex(Vertices, 4, +unit, +unit, -unit); SetVertex(Vertices, 5, +unit, +unit, +unit); SetVertex(Vertices, 6, +unit, -unit, -unit); SetVertex(Vertices, 7, +unit, -unit, +unit); SetUV(UVs, 4, a0, a1); SetUV(UVs, 5, a1, a1); SetUV(UVs, 6, a0, a0); SetUV(UVs, 7, a1, a0); // Back SetVertex(Vertices, 8 , +unit, +unit, +unit); SetVertex(Vertices, 9 , -unit, +unit, +unit); SetVertex(Vertices, 10, +unit, -unit, +unit); SetVertex(Vertices, 11, -unit, -unit, +unit); SetUV(UVs, 8 , a0, a1); SetUV(UVs, 9 , a1, a1); SetUV(UVs, 10, a0, a0); SetUV(UVs, 11, a1, a0); // Left SetVertex(Vertices, 12, -unit, +unit, +unit); SetVertex(Vertices, 13, -unit, +unit, -unit); SetVertex(Vertices, 14, -unit, -unit, +unit); SetVertex(Vertices, 15, -unit, -unit, -unit); SetUV(UVs, 12, a0, a1); SetUV(UVs, 13, a1, a1); SetUV(UVs, 14, a0, a0); SetUV(UVs, 15, a1, a0); // Top SetVertex(Vertices, 16, -unit, +unit, +unit); SetVertex(Vertices, 17, +unit, +unit, +unit); SetVertex(Vertices, 18, -unit, +unit, -unit); SetVertex(Vertices, 19, +unit, +unit, -unit); SetUV(UVs, 16, a0, a1); SetUV(UVs, 17, a1, a1); SetUV(UVs, 18, a0, a0); SetUV(UVs, 19, a1, a0); // Bottom SetVertex(Vertices, 20, -unit, -unit, -unit); SetVertex(Vertices, 21, +unit, -unit, -unit); SetVertex(Vertices, 22, -unit, -unit, +unit); SetVertex(Vertices, 23, +unit, -unit, +unit); SetUV(UVs, 20, a0, a1); SetUV(UVs, 21, a1, a1); SetUV(UVs, 22, a0, a0); SetUV(UVs, 23, a1, a0); for (int i=0; i<24*3; i++) (Vertices)[i] = (Vertices)[i] * (scale); }
void CUIImageBox::SetImageByType(eImageType type, int index, int nSyndiType /* = 0 */) { FLOAT fTexWidth; FLOAT fTexHeight; int nTexRow, nTexCol; int nTextureID; switch(type) { case IT_EXP://hardcoding { nTextureID = 1; nTexRow = 15; nTexCol = 5; m_eUBType = UBET_ITEM; } break; case IT_SP: // [090617: selo] SP 이미지 추가 하드코딩 { // only russia sp icon [9/9/2010 rumist] #if defined (G_RUSSIA) nTextureID = 12; nTexRow = 0; nTexCol = 2; m_eUBType = UBET_ITEM; #else nTextureID = 9; nTexRow = 12; nTexCol = 11; m_eUBType = UBET_ITEM; #endif } break; case IT_MONEY: case IT_ITEM: { if(IT_MONEY == type) index = 19;//hardcoding CItemData* pItemData = _pNetwork->GetItemData( index ); nTextureID = pItemData->GetIconTexID(); nTexRow = pItemData->GetIconTexRow(); nTexCol = pItemData->GetIconTexCol(); m_eUBType = UBET_ITEM; } break; case IT_SKILL: { CSkill &rSkillData = _pNetwork->GetSkillData( index ); nTextureID = rSkillData.GetIconTexID(); nTexRow = rSkillData.GetIconTexRow(); nTexCol = rSkillData.GetIconTexCol(); m_eUBType = UBET_SKILL; } break; case IT_SSKILL:// Special Skill { CSpecialSkill* pSSkillData = CSpecialSkill::getData(index); if (pSSkillData == NULL) return; nTextureID = pSSkillData->GetIconTexID(); nTexRow = pSSkillData->GetIconTexRow(); nTexCol = pSSkillData->GetIconTexCol(); m_eUBType = UBET_SKILL; } break; case IT_ACTION: { CAction* pActionData = CAction::getData(index); if (pActionData == NULL) return; nTextureID = pActionData->GetTexID(); nTexRow = pActionData->GetTexRow(); nTexCol = pActionData->GetTexCol(); m_eUBType = UBET_ACTION; } break; case IT_RVR_POINT: { nTextureID = 19; nTexRow = 2; nTexCol = 3; m_eUBType = UBET_ITEM; // 딜라문 npc면 if (nSyndiType == 2) nTexCol = 4; } break; case IT_CORPS: { InitCorpsImageBox(); SetImageForCorps( type, index ); return; } break; case IT_AFFINITY: // 친화도 개편2 이미지 박스에 친화도 추가 [2/6/2013 Ranma] { CAffinityData* rAffinityData = _pNetwork->GetAffinityData(); nTextureID = rAffinityData->GetAffinityDataByIndex(index)->nIconTextureID; nTexRow = rAffinityData->GetAffinityDataByIndex(index)->nIconTextureRow; nTexCol = rAffinityData->GetAffinityDataByIndex(index)->nIconTextureCol; m_eUBType = UBET_SKILL; } break; case IT_AFFINITY_MONSTER: // 친화도 개편2 이미지 박스에 친화도 추가 [2/6/2013 Ranma] { CAffinityData* pTempAffinityData = _pNetwork->GetAffinityData(); // 맵은 키값으로 소팅이 되기 때문에 값이 뒤에서부터 들어가 있다. 그래서 뒤에서 부터 값을 가져도록 하자 최대한 근접하게 [2/7/2013 Ranma] CAffinityData::mapAffReverseIter itermapBegin = pTempAffinityData->mapAffinity_Data.rbegin(); CAffinityData::mapAffReverseIter itermapEnd = pTempAffinityData->mapAffinity_Data.rend(); CAffinityData::mapAffReverseIter itermapP = itermapBegin; for (; itermapP != itermapEnd; itermapP++) { int pInfoIndex = (*itermapP).first; int nNPCIndex = _pNetwork->GetAffinityData()->GetAdminNPCIndex(pInfoIndex); std::vector<CAffinityData::_AffinityMonsterInfo>::iterator b, e; b = _pNetwork->GetAffinityData()->GetAffinityData(nNPCIndex)->vecMonsterList.begin(); e = _pNetwork->GetAffinityData()->GetAffinityData(nNPCIndex)->vecMonsterList.end(); for (int i = 0; b != e; b++, i++) { if ( b->index == index) { nTextureID = b->TextureID; nTexRow = b->TextureRow; nTexCol = b->TextureCol; m_eUBType = UBET_COMBO; fTexWidth = _pUIBtnTexMgr->GetTexWidth( UIBtnExType(m_eUBType), nTextureID ); fTexHeight = _pUIBtnTexMgr->GetTexHeight( UIBtnExType(m_eUBType), nTextureID ); m_ptdBaseTexture = _pUIBtnTexMgr->GetTex( UIBtnExType(m_eUBType), nTextureID ); m_ptdBaseTexture->AddReference(); int nUVSX = 50 * nTexCol; int nUVSY = 50 * nTexRow; SetUV( nUVSX, nUVSY, nUVSX + 50, nUVSY + 50, fTexWidth, fTexHeight ); m_eImageType = type; m_nTextureID = nTextureID; return; } } } } break; default: { ASSERTALWAYS("Somthing wrong"); } break; } fTexWidth = _pUIBtnTexMgr->GetTexWidth( UIBtnExType(m_eUBType), nTextureID ); fTexHeight = _pUIBtnTexMgr->GetTexHeight( UIBtnExType(m_eUBType), nTextureID ); m_ptdBaseTexture = _pUIBtnTexMgr->GetTex( UIBtnExType(m_eUBType), nTextureID ); m_ptdBaseTexture->AddReference(); int nUVSX = BTN_SIZE * nTexCol; int nUVSY = BTN_SIZE * nTexRow; SetUV( nUVSX, nUVSY, nUVSX + BTN_SIZE, nUVSY + BTN_SIZE, fTexWidth, fTexHeight ); m_eImageType = type; m_nTextureID = nTextureID; }
/*!*************************************************************************** @Function PVRTCreateSkybox @Input scale Scale the skybox @Input adjustUV Adjust or not UVs for PVRT compression @Input textureSize Texture size in pixels @Output Vertices Array of vertices @Output UVs Array of UVs @Description Creates the vertices and texture coordinates for a skybox *****************************************************************************/ void PVRTCreateSkybox(float scale, bool adjustUV, int textureSize, VERTTYPE** Vertices, VERTTYPE** UVs) { *Vertices = new VERTTYPE[24*3]; *UVs = new VERTTYPE[24*2]; VERTTYPE unit = f2vt(1); VERTTYPE a0 = 0, a1 = unit; if (adjustUV) { VERTTYPE oneover = f2vt(1.0f / textureSize); a0 = VERTTYPEMUL(f2vt(4.0f), oneover); a1 = unit - a0; } // Front SetVertex(Vertices, 0, -unit, +unit, -unit); SetVertex(Vertices, 1, +unit, +unit, -unit); SetVertex(Vertices, 2, -unit, -unit, -unit); SetVertex(Vertices, 3, +unit, -unit, -unit); SetUV(UVs, 0, a0, a1); SetUV(UVs, 1, a1, a1); SetUV(UVs, 2, a0, a0); SetUV(UVs, 3, a1, a0); // Right SetVertex(Vertices, 4, +unit, +unit, -unit); SetVertex(Vertices, 5, +unit, +unit, +unit); SetVertex(Vertices, 6, +unit, -unit, -unit); SetVertex(Vertices, 7, +unit, -unit, +unit); SetUV(UVs, 4, a0, a1); SetUV(UVs, 5, a1, a1); SetUV(UVs, 6, a0, a0); SetUV(UVs, 7, a1, a0); // Back SetVertex(Vertices, 8 , +unit, +unit, +unit); SetVertex(Vertices, 9 , -unit, +unit, +unit); SetVertex(Vertices, 10, +unit, -unit, +unit); SetVertex(Vertices, 11, -unit, -unit, +unit); SetUV(UVs, 8 , a0, a1); SetUV(UVs, 9 , a1, a1); SetUV(UVs, 10, a0, a0); SetUV(UVs, 11, a1, a0); // Left SetVertex(Vertices, 12, -unit, +unit, +unit); SetVertex(Vertices, 13, -unit, +unit, -unit); SetVertex(Vertices, 14, -unit, -unit, +unit); SetVertex(Vertices, 15, -unit, -unit, -unit); SetUV(UVs, 12, a0, a1); SetUV(UVs, 13, a1, a1); SetUV(UVs, 14, a0, a0); SetUV(UVs, 15, a1, a0); // Top SetVertex(Vertices, 16, -unit, +unit, +unit); SetVertex(Vertices, 17, +unit, +unit, +unit); SetVertex(Vertices, 18, -unit, +unit, -unit); SetVertex(Vertices, 19, +unit, +unit, -unit); SetUV(UVs, 16, a0, a1); SetUV(UVs, 17, a1, a1); SetUV(UVs, 18, a0, a0); SetUV(UVs, 19, a1, a0); // Bottom SetVertex(Vertices, 20, -unit, -unit, -unit); SetVertex(Vertices, 21, +unit, -unit, -unit); SetVertex(Vertices, 22, -unit, -unit, +unit); SetVertex(Vertices, 23, +unit, -unit, +unit); SetUV(UVs, 20, a0, a1); SetUV(UVs, 21, a1, a1); SetUV(UVs, 22, a0, a0); SetUV(UVs, 23, a1, a0); for (int i=0; i<24*3; i++) (*Vertices)[i] = VERTTYPEMUL((*Vertices)[i], f2vt(scale)); }
void RAS_TexVert::TransformUV(int index, const MT_Matrix4x4& mat) { SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0, 1.0)).getValue()); }