static void OnClickedFilter_Populated(long,short hittype,C_Base *control) { if(hittype != C_TYPE_LMOUSEUP) return; SetFilterMode(FILTER_MODE_POPULATED); }
static void OnClickedFilter_Dogfight(long,short hittype,C_Base *control) { if(hittype != C_TYPE_LMOUSEUP) return; SetFilterMode(FILTER_MODE_DOGFIGHT); }
static void OnClickedFilter_Favorites(long,short hittype,C_Base *control) { if(hittype != C_TYPE_LMOUSEUP) return; SetFilterMode(FILTER_MODE_FAVORITES); }
static void OnClickedFilter_All(long,short hittype,C_Base *control) { if(hittype != C_TYPE_LMOUSEUP) return; SetFilterMode(FILTER_MODE_ALL); }
static void OnClickedFilter_Campaign(long,short hittype,C_Base *control) { if(hittype != C_TYPE_LMOUSEUP) return; SetFilterMode(FILTER_MODE_CAMPAIGN); }
EditorCamera::EditorCamera(const std::string& name) : EditorSceneNode(name) { SetMesh(Mesh::GetOrCreate<QuadMesh>("NSGEditorCamera")); SetMaterial(Material::GetOrCreate("NSGEditorCamera")); material_->SetRenderPass(RenderPass::TEXT); material_->SetDiffuseColor(COLOR_DODGER_BLUE); material_->EnableTransparent(true); material_->SetAlpha(0.9f); material_->SetBillboardType(BillboardType::SPHERICAL); material_->CastShadow(false); material_->ReceiveShadows(false); const int SIZE = 8; static const unsigned char image[SIZE][SIZE] { {X X X X X X X X}, {X O O O O O O X}, {X O X X X X O X}, {X O X O O O O X}, {X O X O O O O X}, {X O X X X X O X}, {X O O O O O O X}, {X X X X X X X X}, }; auto texture = std::make_shared<Texture2D>(); texture->SetFormat(GL_ALPHA); texture->SetData(&image[0][0]); texture->SetSize(SIZE, SIZE); texture->SetMapType(TextureType::COL); material_->SetTextMap(texture); texture->SetFilterMode(TextureFilterMode::NEAREST); }
CTradeGridBase::CTradeGridBase(int nRows /* = 1 */, int nCols /* = 0 */, int nFixedRows /* = 1 */, int nFixedCols /* = 0 */) :CHSGridTable(nRows,nCols,nFixedRows,nFixedCols) { m_pTradeTable = NULL; m_pDataList = NULL; SetEditable(FALSE); SetListMode(); EnableSelection(); SetFixedRowSelection(TRUE); SetFixedColumnSelection(FALSE); SetHeaderSort(); SetGridLines(); SetColumnResize(); SetRowResize(FALSE); SetVirtualMode(FALSE); SetDoubleBuffering(); SetAlwaysShowSelection(); SetFrameFocusCell(FALSE); SetTotalMode(FALSE); SetFilterMode(FALSE); AllowSelectRowInFixedCol(true); EnableDragRowMode(); SetDefCellHeight(25); SetDefCellMargin(2); }
void Texture2D::ReadXMLInfo(const XMLNode *xmlInfo) { Asset::ReadXMLInfo(xmlInfo); m_filepath = xmlInfo->GetFilepath("ImageFilepath"); LoadFromFile(m_filepath); SetFilterMode(FilterMode_FromString(xmlInfo->GetEnumSelectedName("FilterMode"))); SetAlphaCuttoff(xmlInfo->GetFloat("AlphaCuttoff")); }
void Texture::SetParameters(const XMLElement& element) { XMLElement paramElem = element.GetChild(); while (paramElem) { String name = paramElem.GetName(); if (name == "address") { String coord = paramElem.GetAttributeLower("coord"); if (coord.Length() >= 1) { TextureCoordinate coordIndex = (TextureCoordinate)(coord[0] - 'u'); String mode = paramElem.GetAttributeLower("mode"); SetAddressMode(coordIndex, (TextureAddressMode)GetStringListIndex(mode.CString(), addressModeNames, ADDRESS_WRAP)); } } if (name == "border") SetBorderColor(paramElem.GetColor("color")); if (name == "filter") { String mode = paramElem.GetAttributeLower("mode"); SetFilterMode((TextureFilterMode)GetStringListIndex(mode.CString(), filterModeNames, FILTER_DEFAULT)); } if (name == "mipmap") SetNumLevels(paramElem.GetBool("enable") ? 0 : 1); if (name == "quality") { if (paramElem.HasAttribute("low")) SetMipsToSkip(QUALITY_LOW, paramElem.GetInt("low")); if (paramElem.HasAttribute("med")) SetMipsToSkip(QUALITY_MEDIUM, paramElem.GetInt("med")); if (paramElem.HasAttribute("medium")) SetMipsToSkip(QUALITY_MEDIUM, paramElem.GetInt("medium")); if (paramElem.HasAttribute("high")) SetMipsToSkip(QUALITY_HIGH, paramElem.GetInt("high")); } if (name == "srgb") SetSRGB(paramElem.GetBool("enable")); paramElem = paramElem.GetNext(); } }
//---------------------------------------------------------- // Builds the texture from the given TGA file. Mipmap levels // are automatically generated //---------------------------------------------------------- void Texture::LoadFromTGA(const std::string& p_strFile) { glGenTextures(1,&m_uiTex); glBindTexture(GL_TEXTURE_2D, m_uiTex); GLFWimage img; glfwReadImage( p_strFile.c_str(), &img, 0 ); glTexImage2D(GL_TEXTURE_2D, 0, img.Format, img.Width, img.Height, 0, img.Format, GL_UNSIGNED_BYTE, img.Data); m_uiWidth = img.Width; m_uiHeight = img.Height; glfwFreeImage(&img); glGenerateMipmap(GL_TEXTURE_2D); SetFilterMode(FM_TrilinearMipmap, FM_Linear); }
bool Texture::Load(const void* wrapper) { std::string str; if (!IsObject(wrapper)) return false; if (!LoadMemberValue(wrapper, "format", str)) { FURYE << "Texture param 'format' not found!"; return false; } auto format = EnumUtil::TextureFormatFromString(str); if (!LoadMemberValue(wrapper, "type", str)) str = EnumUtil::TextureTypeToString(TextureType::TEXTURE_2D); auto type = EnumUtil::TextureTypeFromString(str); int width, height; if (!LoadMemberValue(wrapper, "width", width) || !LoadMemberValue(wrapper, "height", height)) { FURYE << "Texture param 'width/height' not found!"; return false; } auto filterMode = FilterMode::LINEAR; if (LoadMemberValue(wrapper, "filter", str)) filterMode = EnumUtil::FilterModeFromString(str); auto wrapMode = WrapMode::REPEAT; if (LoadMemberValue(wrapper, "wrap", str)) wrapMode = EnumUtil::WrapModeFromString(str); auto color = Color::Black; LoadMemberValue(wrapper, "borderColor", color); SetBorderColor(color); bool mipmap = false; LoadMemberValue(wrapper, "mipmap", mipmap); SetFilterMode(filterMode); SetWrapMode(wrapMode); CreateEmpty(width, height, format, type, mipmap); return true; }
//---------------------------------------------------------- // Constructor taking in data already in ram //---------------------------------------------------------- Texture::Texture(void* p_pData, unsigned int p_uiWidth, unsigned int p_uiHeight, Format p_eFormat) : m_eFilterMin(Texture::FM_Invalid), m_eFilterMag(Texture::FM_Invalid), m_eWrapU(Texture::WM_Invalid), m_eWrapV(Texture::WM_Invalid), m_uiWidth(0), m_uiHeight(0), m_uiTex(0) { glGenTextures(1,&m_uiTex); glBindTexture(GL_TEXTURE_2D, m_uiTex); glTexImage2D(GL_TEXTURE_2D, 0, gs_aFormatMap[p_eFormat], p_uiWidth, p_uiHeight, 0, gs_aFormatMap[p_eFormat], gs_aTypeMap[p_eFormat], p_pData); m_uiWidth = p_uiWidth; m_uiHeight = p_uiHeight; SetWrapMode(WM_Clamp); glGenerateMipmap(GL_TEXTURE_2D); SetFilterMode(FM_TrilinearMipmap, FM_Linear); }
//-------------------------------------------------- //-------------------------------------------------- void Texture::Restore() { CS_ASSERT(GetStorageLocation() == CSCore::StorageLocation::k_none, "Cannot restore texture that was loaded from file. This should be handled using RefreshResource()."); Texture::Descriptor desc; desc.m_width = m_width; desc.m_height = m_height; desc.m_format = m_format; desc.m_compression = m_compression; desc.m_dataSize = m_restorationDataSize; WrapMode sWrap = m_sWrapMode; WrapMode tWrap = m_tWrapMode; FilterMode filterMode = m_filterMode; Build(desc, std::move(m_restorationData), m_hasMipMaps, m_restoreTextureDataEnabled); SetWrapMode(sWrap, tWrap); SetFilterMode(filterMode); }
bool GLVideo::StartApplication( const unsigned int width, const unsigned int height, const str_type::string& winTitle, const bool windowed, const bool sync, const Texture::PIXEL_FORMAT pfBB, const bool maximizable) { SetFilterMode(Video::TM_ALWAYS); SetAlphaMode(Video::AM_PIXEL); SetZBuffer(false); SetZWrite(false); SetClamp(true); SetBlendMode(1, Video::BM_MODULATE); Enable2DStates(); // don't reset cg context if it is an opengl context reset if (!m_shaderContext) m_shaderContext = GLCgShaderContextPtr(new GLCgShaderContext); if (!m_defaultVS) m_defaultVS = LoadShaderFromString("defaultShader", gs2dglobal::defaultVSCode, Shader::SF_VERTEX, Shader::SP_MODEL_2, "sprite"); if (!m_rectVS) m_rectVS = LoadShaderFromString("rectShader", gs2dglobal::defaultVSCode, Shader::SF_VERTEX, Shader::SP_MODEL_2, "rectangle"); if (!m_fastVS) m_fastVS = LoadShaderFromString("fastShader", gs2dglobal::fastSimpleVSCode, Shader::SF_VERTEX, Shader::SP_MODEL_2, "fast"); m_currentVS = m_defaultVS; UpdateInternalShadersViewData(GetScreenSizeF(), false); return true; }
std::shared_ptr<Material> FbxUtil::CreateMaterial(FbxSurfaceMaterial *fbxMaterial) { // a,d,s, Intensity(Factor), Shininess, Reflectivity, Transparency //GetImplementation(material, FBXSDK_IMP) FbxSurfacePhong *fbxPhong = static_cast<FbxSurfacePhong*>(fbxMaterial); Material::Ptr material = Material::Create(fbxPhong->GetName()); // read uniforms material->SetUniform(Material::SHININESS, Uniform1f::Create({ (float)fbxPhong->Shininess })); material->SetUniform(Material::AMBIENT_FACTOR, Uniform1f::Create({ (float)fbxPhong->AmbientFactor })); material->SetUniform(Material::DIFFUSE_FACTOR, Uniform1f::Create({ (float)fbxPhong->DiffuseFactor })); material->SetUniform(Material::SPECULAR_FACTOR, Uniform1f::Create({ (float)fbxPhong->SpecularFactor })); auto GetUniform3f = [](FbxPropertyT<FbxDouble3> &data) -> UniformBase::Ptr { return Uniform3f::Create({ (float)data.Get()[0], (float)data.Get()[1], (float)data.Get()[2] }); }; // read colors material->SetUniform(Material::AMBIENT_COLOR, GetUniform3f(fbxPhong->Ambient)); material->SetUniform(Material::DIFFUSE_COLOR, GetUniform3f(fbxPhong->Diffuse)); material->SetUniform(Material::SPECULAR_COLOR, GetUniform3f(fbxPhong->Specular)); material->SetUniform(Material::MATERIAL_ID, Uniform1ui::Create({ material->GetID() })); auto GetTexture = [&](FbxPropertyT<FbxDouble3> prop) -> Texture::Ptr { if (prop.IsValid() && prop.GetSrcObjectCount<FbxTexture>() > 0) { FbxTexture *fbxTexture = prop.GetSrcObject<FbxTexture>(0); FbxFileTexture *fileTexture = FbxCast<FbxFileTexture>(fbxTexture); if (fileTexture) { bool mipMap = (bool)fileTexture->UseMipMap; std::string filePath = FileUtil::Instance()->GetAbsPath(fileTexture->GetRelativeFileName(), true); auto texture = Texture::Create(fileTexture->GetName()); texture->SetFilterMode(mipMap ? FilterMode::LINEAR_MIPMAP_LINEAR : FilterMode::LINEAR); texture->CreateFromImage(filePath, mipMap); return texture; } else { LOGW << "FbxProceduralTexture not supported!"; } } return nullptr; }; // read tetxures. if(m_Options & Options::DIFFUSE_MAP) material->SetTexture(Material::DIFFUSE_TEXTURE, GetTexture(fbxPhong->Diffuse)); if(m_Options & Options::SPECULAR_MAP) material->SetTexture(Material::SPECULAR_TEXTURE, GetTexture(fbxPhong->Specular)); if(m_Options & Options::NORMAL_MAP) material->SetTexture(Material::NORMAL_TEXTURE, GetTexture(fbxPhong->NormalMap)); LOGD << fbxMaterial->GetName(); return material; }