コード例 #1
0
ファイル: CShader.cpp プロジェクト: codereader/DarkRadiant
bool CShader::isDiscrete() const
{
	int flags = getSurfaceFlags();
	return (flags & SURF_ENTITYGUI) /*|| gui*/ || getDeformType() != DEFORM_NONE || 
			getSortRequest() == SORT_SUBVIEW || (flags & SURF_DISCRETE);
}
コード例 #2
0
        void FaceAttribsEditor::updateControls() {
            if (hasSurfaceAttribs()) {
                showSurfaceAttribEditors();
                wxArrayString surfaceFlagLabels, surfaceFlagTooltips, contentFlagLabels, contentFlagTooltips;
                getSurfaceFlags(surfaceFlagLabels, surfaceFlagTooltips);
                getContentFlags(contentFlagLabels, contentFlagTooltips);
                m_surfaceFlagsEditor->setFlags(surfaceFlagLabels, surfaceFlagTooltips);
                m_contentFlagsEditor->setFlags(contentFlagLabels, contentFlagTooltips);
            } else {
                hideSurfaceAttribEditors();
            }
            
            if (!m_faces.empty()) {
                bool textureMulti = false;
                bool xOffsetMulti = false;
                bool yOffsetMulti = false;
                bool rotationMulti = false;
                bool xScaleMulti = false;
                bool yScaleMulti = false;
                bool surfaceValueMulti = false;
                
                Assets::Texture* texture = m_faces[0]->texture();
                const float xOffset = m_faces[0]->xOffset();
                const float yOffset = m_faces[0]->yOffset();
                const float rotation = m_faces[0]->rotation();
                const float xScale = m_faces[0]->xScale();
                const float yScale = m_faces[0]->yScale();
                int setSurfaceFlags = m_faces[0]->surfaceFlags();
                int setSurfaceContents = m_faces[0]->surfaceContents();
                int mixedSurfaceFlags = 0;
                int mixedSurfaceContents = 0;
                const float surfaceValue = m_faces[0]->surfaceValue();
                
                for (size_t i = 1; i < m_faces.size(); i++) {
                    Model::BrushFace* face = m_faces[i];
                    textureMulti            |= (texture         != face->texture());
                    xOffsetMulti            |= (xOffset         != face->xOffset());
                    yOffsetMulti            |= (yOffset         != face->yOffset());
                    rotationMulti           |= (rotation        != face->rotation());
                    xScaleMulti             |= (xScale          != face->xScale());
                    yScaleMulti             |= (yScale          != face->yScale());
                    surfaceValueMulti       |= (surfaceValue    != face->surfaceValue());
                    
                    combineFlags(sizeof(int)*8, face->surfaceFlags(), setSurfaceFlags, mixedSurfaceFlags);
                    combineFlags(sizeof(int)*8, face->surfaceContents(), setSurfaceContents, mixedSurfaceContents);
                }
                
                m_xOffsetEditor->Enable();
                m_yOffsetEditor->Enable();
                m_rotationEditor->Enable();
                m_xScaleEditor->Enable();
                m_yScaleEditor->Enable();
                m_surfaceValueEditor->Enable();
                m_surfaceFlagsEditor->Enable();
                m_contentFlagsEditor->Enable();
                
                if (textureMulti) {
                    m_textureName->SetLabel("multi");
                    m_textureName->SetForegroundColour(*wxLIGHT_GREY);
                    m_textureSize->SetLabel("multi");
                    m_textureSize->SetForegroundColour(*wxLIGHT_GREY);
                } else {
                    const String& textureName = m_faces[0]->textureName();
                    if (textureName == Model::BrushFace::NoTextureName) {
                        m_textureName->SetLabel("none");
                        m_textureName->SetForegroundColour(*wxLIGHT_GREY);
                        m_textureSize->SetLabel("");
                        m_textureSize->SetForegroundColour(*wxLIGHT_GREY);
                    } else {
                        if (texture != NULL) {
                            wxString sizeLabel;
                            sizeLabel << texture->width() << "*" << texture->height();

                            m_textureName->SetLabel(textureName);
                            m_textureSize->SetLabel(sizeLabel);
                            m_textureName->SetForegroundColour(GetForegroundColour());
                            m_textureSize->SetForegroundColour(GetForegroundColour());
                        } else {
                            m_textureName->SetLabel(textureName + " (not found)");
                            m_textureName->SetForegroundColour(*wxLIGHT_GREY);
                            m_textureSize->SetForegroundColour(*wxLIGHT_GREY);
                        }
                    }
                }
                if (xOffsetMulti) {
                    m_xOffsetEditor->SetHint("multi");
                    m_xOffsetEditor->SetValue("");
                } else {
                    m_xOffsetEditor->SetHint("");
                    m_xOffsetEditor->SetValue(xOffset);
                }
                if (yOffsetMulti) {
                    m_yOffsetEditor->SetHint("multi");
                    m_yOffsetEditor->SetValue("");
                } else {
                    m_yOffsetEditor->SetHint("");
                    m_yOffsetEditor->SetValue(yOffset);
                }
                if (rotationMulti) {
                    m_rotationEditor->SetHint("multi");
                    m_rotationEditor->SetValue("");
                } else {
                    m_rotationEditor->SetHint("");
                    m_rotationEditor->SetValue(rotation);
                }
                if (xScaleMulti){
                    m_xScaleEditor->SetHint("multi");
                    m_xScaleEditor->SetValue("");
                } else {
                    m_xScaleEditor->SetHint("");
                    m_xScaleEditor->SetValue(xScale);
                }
                if (yScaleMulti) {
                    m_yScaleEditor->SetHint("multi");
                    m_yScaleEditor->SetValue("");
                } else {
                    m_yScaleEditor->SetHint("");
                    m_yScaleEditor->SetValue(yScale);
                }
                if (surfaceValueMulti) {
                    m_surfaceValueEditor->SetHint("multi");
                    m_surfaceValueEditor->SetValue("");
                } else {
                    m_surfaceValueEditor->SetHint("");
                    m_surfaceValueEditor->SetValue(surfaceValue);
                }
                m_surfaceFlagsEditor->setFlagValue(setSurfaceFlags, mixedSurfaceFlags);
                m_contentFlagsEditor->setFlagValue(setSurfaceContents, mixedSurfaceContents);
            } else {
                m_xOffsetEditor->SetValue("n/a");
                m_xOffsetEditor->Disable();
                m_yOffsetEditor->SetValue("n/a");
                m_yOffsetEditor->Disable();
                m_xScaleEditor->SetValue("n/a");
                m_xScaleEditor->Disable();
                m_yScaleEditor->SetValue("n/a");
                m_yScaleEditor->Disable();
                m_rotationEditor->SetValue("n/a");
                m_rotationEditor->Disable();
                m_surfaceValueEditor->SetValue("n/a");
                m_surfaceValueEditor->Disable();
                // m_textureView->setTexture(NULL);
                m_surfaceFlagsEditor->Disable();
                m_contentFlagsEditor->Disable();
            }
        }
コード例 #3
0
ファイル: CShader.cpp プロジェクト: codereader/DarkRadiant
bool CShader::isDrawn() const
{
	return _template->getLayers().size() > 0 || (getSurfaceFlags() & SURF_ENTITYGUI) /*|| gui != NULL*/;
}