const Entity EntityBuilder::CreateObject(const XMVECTOR & pos, const XMVECTOR & rot, const XMVECTOR & scale, const std::string& meshtext, const std::string& texture, const std::string& normal, const std::string& displacement, const std::string& roughness, const std::string& glossiness) { Entity ent = _entity.Create(); _transform->CreateTransform(ent); _mesh->CreateStaticMesh(ent, meshtext.c_str()); _material->BindMaterial(ent, "Shaders/GBuffer.hlsl"); std::vector<string> pro; pro.push_back("DiffuseMap"); pro.push_back("NormalMap"); pro.push_back("DisplacementMap"); pro.push_back("Roughness"); pro.push_back("Glossiness"); std::vector<wstring> texs; texs.push_back(S2WS(texture)); texs.push_back(S2WS(normal)); texs.push_back(S2WS(displacement)); texs.push_back(S2WS(roughness)); texs.push_back(S2WS(glossiness)); _material->SetEntityTexture(ent,pro, texs); _material->SetMaterialProperty(ent, "TexCoordScaleU", 1.0f, "Shaders/GBuffer.hlsl"); _material->SetMaterialProperty(ent, "TexCoordScaleV", 1.0f, "Shaders/GBuffer.hlsl"); _transform->SetPosition(ent, pos); _transform->SetRotation(ent, rot); _transform->SetScale(ent, scale); return ent; }
int __gnat_mkdir (char *dir_name, int encoding ATTRIBUTE_UNUSED) { #if defined (__vxworks) /* Pretend that the system mkdir is posix compliant even though it sometimes is not, not expecting the second argument in some configurations (e.g. vxworks 653 2.2, difference from 2.5). The second actual argument will just be ignored in this case. */ typedef int posix_mkdir (const char * name, mode_t mode); posix_mkdir * vxmkdir = (posix_mkdir *)&mkdir; return vxmkdir (dir_name, S_IRWXU | S_IRWXG | S_IRWXO); #elif defined (__MINGW32__) TCHAR wname [GNAT_MAX_PATH_LEN + 2]; if (encoding == Encoding_Unspecified) S2WSC (wname, dir_name, GNAT_MAX_PATH_LEN); else if (encoding == Encoding_UTF8) S2WSU (wname, dir_name, GNAT_MAX_PATH_LEN); else S2WS (wname, dir_name, GNAT_MAX_PATH_LEN); return _tmkdir (wname); #else return mkdir (dir_name, S_IRWXU | S_IRWXG | S_IRWXO); #endif }
const Entity EntityBuilder::CreateButton(const XMFLOAT3 & position, const std::string & text, float fontSize, const XMFLOAT4& textColor, float width, float height, const std::string & texture, std::function<void()> callback) { auto a = System::GetInstance()->GetAudio(); Entity ent = _entity.Create(); _overlay->CreateOverlay(ent); _transform->CreateTransform(ent); _text->BindText(ent, text, "Assets/Fonts/cooper", fontSize, textColor); if (!texture.empty()) { _material->BindMaterial(ent, "Shaders/GBuffer.hlsl"); _material->SetEntityTexture(ent, "DiffuseMap", S2WS(texture).c_str()); } _event->BindEvent(ent, EventManager::EventType::LeftClick, callback); _transform->SetPosition(ent, position); _overlay->SetExtents(ent, width, height); _controller->BindEvent(ent, EventManager::EventType::OnEnter, [ent, this, a, textColor]() { this->_text->ChangeColor(ent, XMFLOAT4(textColor.x*this->_hoverColorInc, textColor.y*this->_hoverColorInc, textColor.z*this->_hoverColorInc, 1.0f)); a->PlaySoundEffect(L"menuhover.wav", 1); }); _controller->BindEvent(ent, EventManager::EventType::OnExit, [ent, this, textColor]() { this->_text->ChangeColor(ent, textColor); }); return ent; }
const Entity EntityBuilder::CreateImage(const XMFLOAT3 & position, float width, float height, const std::string & texture) { Entity ent = _entity.Create(); _material->BindMaterial(ent, "Shaders/GBuffer.hlsl"); _overlay->CreateOverlay(ent); _transform->CreateTransform(ent); _material->SetEntityTexture(ent, "DiffuseMap", S2WS(texture).c_str()); _transform->SetPosition(ent, position); _overlay->SetExtents(ent, width, height); return ent; }
const Entity EntityBuilder::CreateDecal(const XMFLOAT3 & pos, const XMFLOAT3 & rot, const XMFLOAT3 & scale, const std::string & colorTex, const std::string& normalTex, const std::string& emissiveTex) { Entity ent = _entity.Create(); _decal->BindDecal(ent); _transform->SetScale(ent, XMVectorSet(scale.x, scale.y, scale.z, 0.0f)); _transform->SetRotation(ent, XMVectorSet(rot.x, rot.y, rot.z, 0.0f)); _transform->SetPosition(ent, XMVectorSet(pos.x, pos.y, pos.z, 1.0f)); std::vector<string> pro; pro.push_back("gColor"); pro.push_back("gNormal"); pro.push_back("gEmissive"); std::vector<wstring> texs; texs.push_back(S2WS(colorTex)); texs.push_back(S2WS(normalTex)); texs.push_back(S2WS(emissiveTex)); _material->SetEntityTexture(ent, pro, texs); return ent; }
const Entity EntityBuilder::CreateLabel(const XMFLOAT3 & position, const std::string & text, float fontSize, const XMFLOAT4 & textColor, float width, float height, const std::string & texture) { Entity ent = _entity.Create(); _transform->CreateTransform(ent); _text->BindText(ent, text, "Assets/Fonts/cooper", fontSize, textColor); if (!texture.empty()) { _overlay->CreateOverlay(ent); _overlay->SetExtents(ent, width, height); _material->BindMaterial(ent, "Shaders/GBuffer.hlsl"); _material->SetEntityTexture(ent, "DiffuseMap", S2WS(texture).c_str()); } _transform->SetPosition(ent, position); return ent; }
int __gnat_mkdir (char *dir_name, int encoding ATTRIBUTE_UNUSED) { #if defined (__vxworks) && !(defined (__RTP__) && (_WRS_VXWORKS_MINOR != 0)) return mkdir (dir_name); #elif defined (__MINGW32__) TCHAR wname [GNAT_MAX_PATH_LEN + 2]; if (encoding == Encoding_Unspecified) S2WSC (wname, dir_name, GNAT_MAX_PATH_LEN); else if (encoding == Encoding_UTF8) S2WSU (wname, dir_name, GNAT_MAX_PATH_LEN); else S2WS (wname, dir_name, GNAT_MAX_PATH_LEN); return _tmkdir (wname); #else return mkdir (dir_name, S_IRWXU | S_IRWXG | S_IRWXO); #endif }
void CAviHelper::AVItoBmp(const string& strAVIFileName, const string& strBmpDir) { AVItoBmp(S2WS(strAVIFileName), S2WS(strBmpDir)); }
bool CAviHelper::AVI_resolution(const string& strAviFileName, int& width, int& height) { return AVI_resolution(S2WS(strAviFileName), width, height); }
void CAviHelper::BMPtoAVI(const string& szAVIName, const string& strBDir) { BMPtoAVI(S2WS(szAVIName), S2WS(strBDir)); }
bool CFileBackUp::BackUp(const string& src, const string& dst) { return BackUp(S2WS(src), S2WS(dst)); }