void SGOglTextureCoordNBPage::OnTextEnterObjCoeffT(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); wxArrayString userEnteredValues; vec4 objPlaneTVec; if((parseVector(objectPlaneCoeffTextT->GetValue())).GetCount() == 4) { userEnteredValues = parseVector(objectPlaneCoeffTextT->GetValue()); for(int i = 0; i < 4; i++) { objPlaneTVec[i] = atof(userEnteredValues.Item(i).mb_str()); } glState->GetTexture(texCoordUnitBox->GetSelection())->objectPlaneCoeffT = objPlaneTVec; } else { IncorrectFormat(wxT("four floating point values, with each value seperated by a comma."), *this); return; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureEnvNBPage::OnChoiceTextureCombineMode(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(textureBox->GetSelection()); switch(texCombineModeChoose->GetSelection()) { case 0: texture->textureCombineMode = GL_REPLACE; break; case 1: texture->textureCombineMode = GL_MODULATE; break; case 2: texture->textureCombineMode = GL_ADD; break; case 3: texture->textureCombineMode = GL_ADD_SIGNED; break; case 4: texture->textureCombineMode = GL_INTERPOLATE; break; case 5: texture->textureCombineMode = GL_SUBTRACT; break; case 6: texture->textureCombineMode = GL_DOT3_RGB; break; default: break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureCoordNBPage::UpdateWidgets() { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(texCoordUnitBox->GetSelection()); switch(texture->textureCoordinateGeneration){ case GL_OBJECT_LINEAR: coordGenBox->SetSelection(TEXTURE_COORDINATE_OBJECT_LINEAR); break; case GL_EYE_LINEAR: coordGenBox->SetSelection(TEXTURE_COORDINATE_EYE_LINEAR); break; case GL_SPHERE_MAP: coordGenBox->SetSelection(TEXTURE_COORDINATE_SPHERE_MAP); break; case GL_REFLECTION_MAP: coordGenBox->SetSelection(TEXTURE_COORDINATE_REFLECTION_MAP); break; case GL_NORMAL_MAP: coordGenBox->SetSelection(TEXTURE_COORDINATE_NORMAL_MAP); break; default: break; } eyePlaneCoeffTextS->SetValue(FloatToString4(texture->eyePlaneCoeffS)); eyePlaneCoeffTextT->SetValue(FloatToString4(texture->eyePlaneCoeffT)); objectPlaneCoeffTextS->SetValue(FloatToString4(texture->objectPlaneCoeffS)); objectPlaneCoeffTextT->SetValue(FloatToString4(texture->objectPlaneCoeffT)); }
void SGOglMaterialNBPage::OnButton(wxCommandEvent& event) { SGFixedGLState* glState = this->m_parent->GetGLState(); Material* mat = glState->GetMaterial(); glState->SetMaterialChanged(true); switch(event.GetId()) { case Id::AmbientMaterialVal : mat->materialAmbientColorVector = GetDialog(mat, 1); ambientMaterial->SetBackgroundColour(ToWxIntColor(mat->materialAmbientColorVector)); break; case Id::DiffuseMaterialVal : mat->materialDiffuseColorVector = GetDialog(mat, 2); diffuseMaterial->SetBackgroundColour(ToWxIntColor(mat->materialDiffuseColorVector)); break; case Id::SpecularMaterialVal : mat->materialSpecularColorVector = GetDialog(mat, 3); specularMaterial->SetBackgroundColour(ToWxIntColor(mat->materialSpecularColorVector)); break; case Id::EmissionMaterialVal : mat->materialEmissionColorVector = GetDialog(mat, 4); emissionMaterial->SetBackgroundColour(ToWxIntColor(mat->materialEmissionColorVector)); break; default : break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); event.Skip(); }
SGOglMaterialNBPage::SGOglMaterialNBPage(SGOglNotebook* parent, wxWindowID id) :wxPanel(parent,id) { m_parent = parent; SGFixedGLState* glState = m_parent->GetGLState(); Material* mat = glState->GetMaterial(); wxStaticBox* materialBox = new wxStaticBox(this, wxID_ANY, wxT("Material Properties"), wxDefaultPosition, wxDefaultSize, 0); wxStaticBoxSizer* materialSizer = new wxStaticBoxSizer(materialBox, wxHORIZONTAL); wxBoxSizer* v1 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* v2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* v3 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* v4 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* v5 = new wxBoxSizer(wxVERTICAL); shininessMaterial = new wxTextCtrl(this, Id::ShininessMaterialVal, FloatToString1(mat->materialShininess), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, wxT("Specular Exponent")); ambientMaterial = new wxButton(this, Id::AmbientMaterialVal, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Ambient Color of Material")); diffuseMaterial = new wxButton(this, Id::DiffuseMaterialVal, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Diffuse Color of Material")); specularMaterial = new wxButton(this, Id::SpecularMaterialVal,wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Specular Color of Material")); emissionMaterial = new wxButton(this, Id::EmissionMaterialVal,wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Emissive Color of Material")); ambientMaterial->SetBackgroundColour(ToWxIntColor(mat->materialAmbientColorVector)); diffuseMaterial->SetBackgroundColour(ToWxIntColor(mat->materialDiffuseColorVector)); specularMaterial->SetBackgroundColour(ToWxIntColor(mat->materialSpecularColorVector)); emissionMaterial->SetBackgroundColour(ToWxIntColor(mat->materialEmissionColorVector)); wxStaticText* ambientMatLbl = new wxStaticText(this, 0, wxT("GL_AMBIENT"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* specularMatLbl = new wxStaticText(this, 0, wxT("GL_SPECULAR"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* diffuseMatLbl = new wxStaticText(this, 0, wxT("GL_DIFFUSE"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* shininessLbl = new wxStaticText(this, 0, wxT("GL_SHININESS"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* emissionLbl = new wxStaticText(this, 0, wxT("GL_EMISSION"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); v2->Add(ambientMatLbl,0, wxTOP |wxBOTTOM | wxADJUST_MINSIZE, 9); v2->Add(diffuseMatLbl,0, wxTOP |wxBOTTOM | wxADJUST_MINSIZE, 9); v2->Add(specularMatLbl,0, wxTOP |wxBOTTOM | wxADJUST_MINSIZE, 9); v3->Add(ambientMaterial,0, wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE, 5); v3->Add(diffuseMaterial,0, wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE, 5); v3->Add(specularMaterial,0, wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE, 5); v4->Add(shininessLbl,0, wxTOP |wxBOTTOM | wxADJUST_MINSIZE, 9); v4->Add(emissionLbl,0, wxTOP |wxBOTTOM | wxADJUST_MINSIZE, 9); v5->Add(shininessMaterial,0, wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE, 5); v5->Add(emissionMaterial,0, wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE, 5); materialSizer->Add(v1, 0 , wxALL |wxADJUST_MINSIZE, 10); materialSizer->Add(v2, 0 , wxALL |wxADJUST_MINSIZE, 10); materialSizer->Add(v3, 0 , wxALL |wxADJUST_MINSIZE, 10); materialSizer->Add(v4, 0 , wxALL |wxADJUST_MINSIZE, 10); materialSizer->Add(v5, 0 , wxALL |wxADJUST_MINSIZE, 10); this->SetAutoLayout(TRUE); SetSizer( materialSizer ); materialSizer->SetSizeHints( this ); }
void SGOglTextureEnvNBPage::OnChoiceTextureCombineScale(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(textureBox->GetSelection()); texture->textureCombineScale = (float)(1 << texCombineScaleChoose->GetSelection()); wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureEnvNBPage::OnButton(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); wxColour texEnvColor; int textureSelected = textureBox->GetSelection(); texEnvColor = wxGetColourFromUser(this, ToWxIntColor(glState->GetTexture(textureSelected)->texEnvColor)); glState->GetTexture(textureSelected)->texEnvColor = ToGLFPColor(texEnvColor); FindWindowById(event.GetId())->SetBackgroundColour(texEnvColor); wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); event.Skip(); }
void SGOglTextureEnvNBPage::OnCheckbox(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); switch(event.GetId()) { case Id::TexEnableVal: glState->SetTextureEnable(texEnableCheckBox->IsChecked()); break; case Id::Tex0EnableVal: glState->GetTexture(0)->textureEnabled = tex0CheckBox->IsChecked(); break; case Id::Tex1EnableVal: glState->GetTexture(1)->textureEnabled = tex1CheckBox->IsChecked(); break; case Id::Tex2EnableVal: glState->GetTexture(2)->textureEnabled = tex2CheckBox->IsChecked(); break; case Id::Tex3EnableVal: glState->GetTexture(3)->textureEnabled = tex3CheckBox->IsChecked(); break; case Id::Tex4EnableVal: glState->GetTexture(4)->textureEnabled = tex4CheckBox->IsChecked(); break; default: break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglMaterialNBPage::OnTextEnter(wxCommandEvent& event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetMaterialChanged(true); wxArrayString userEnteredValues; if((shininessMaterial->GetValue()).IsEmpty()) { IncorrectFormat(wxT("one floating point value."), *this); return; } glState->GetMaterial()->materialShininess = atof(shininessMaterial->GetValue().mb_str()); wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureEnvNBPage::OnChoiceTextureCombineOperandArg2(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(textureBox->GetSelection()); switch(texCombineOperandArg2Choose->GetSelection()) { case 0: texture->textureCombineOperand2 = GL_SRC_COLOR; break; case 1: texture->textureCombineOperand2 = GL_ONE_MINUS_SRC_COLOR; break; default: break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureEnvNBPage::OnRadioTexApply(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(textureBox->GetSelection()); if(event.GetId() == Id::TexApply) { switch(texApplyBox->GetSelection()) { case 0: texture->textureApplicationMethod = GL_REPLACE; DisableCombine(); break; case 1: texture->textureApplicationMethod = GL_MODULATE; DisableCombine(); break; case 2: texture->textureApplicationMethod = GL_DECAL; DisableCombine(); break; case 3: texture->textureApplicationMethod = GL_BLEND; DisableCombine(); break; case 4: texture->textureApplicationMethod = GL_ADD; DisableCombine(); break; case 5: texture->textureApplicationMethod = GL_COMBINE; EnableCombine(); break; default: texture->textureApplicationMethod = GL_MODULATE; DisableCombine(); break; } } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureCoordNBPage::OnRadioTexCoordGen(wxCommandEvent& event) { SGFixedGLState* glState = m_parent->GetGLState(); int workingTextureCoords; workingTextureCoords = texCoordUnitBox->GetSelection(); switch(coordGenBox->GetSelection()){ case TEXTURE_COORDINATE_OBJECT_LINEAR: glState->GetTexture(workingTextureCoords)->textureCoordinateGeneration = GL_OBJECT_LINEAR; break; case TEXTURE_COORDINATE_EYE_LINEAR: glState->GetTexture(workingTextureCoords)->textureCoordinateGeneration = GL_EYE_LINEAR; break; case TEXTURE_COORDINATE_SPHERE_MAP: glState->GetTexture(workingTextureCoords)->textureCoordinateGeneration = GL_SPHERE_MAP; break; case TEXTURE_COORDINATE_REFLECTION_MAP: glState->GetTexture(workingTextureCoords)->textureCoordinateGeneration = GL_REFLECTION_MAP; break; case TEXTURE_COORDINATE_NORMAL_MAP: glState->GetTexture(workingTextureCoords)->textureCoordinateGeneration = GL_NORMAL_MAP; break; default: break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureEnvNBPage::OnChoiceTextureCombineSrc2RGB(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(textureBox->GetSelection()); switch(texCombineSrc2RGBChoose->GetSelection()) { case 0: texture->textureCombineSource2 = GL_TEXTURE; break; case 1: texture->textureCombineSource2 = GL_CONSTANT; break; case 2: texture->textureCombineSource2 = GL_PRIMARY_COLOR; break; case 3: texture->textureCombineSource2 = GL_PREVIOUS; break; default: break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
void SGOglTextureCoordNBPage::OnCheckbox(wxCommandEvent &event) { SGFixedGLState *glState = m_parent->GetGLState(); switch(event.GetId()){ case Id::Tex0TexGenEnableVal: glState->GetTexture(0)->texGen = tex0TexGenEnableCheckBox->IsChecked(); break; case Id::Tex1TexGenEnableVal: glState->GetTexture(1)->texGen = tex1TexGenEnableCheckBox->IsChecked(); break; case Id::Tex2TexGenEnableVal: glState->GetTexture(2)->texGen = tex2TexGenEnableCheckBox->IsChecked(); break; case Id::Tex3TexGenEnableVal: glState->GetTexture(3)->texGen = tex3TexGenEnableCheckBox->IsChecked(); break; case Id::Tex4TexGenEnableVal: glState->GetTexture(4)->texGen = tex4TexGenEnableCheckBox->IsChecked(); break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); }
SGOglTextureCoordNBPage::SGOglTextureCoordNBPage(SGOglNotebook* parent, wxWindowID id) :wxPanel(parent,id) { m_parent = parent; SGFixedGLState* glState = m_parent->GetGLState(); wxStaticBox* texBox = new wxStaticBox(this, wxID_ANY, wxT("Textures"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBox* texPropertyBox = new wxStaticBox(this, wxID_ANY, wxT("Selected Texture Properties"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBoxSizer* textureSizer = new wxStaticBoxSizer(texBox, wxVERTICAL); wxStaticBoxSizer* selectedTexPropertiesSizer = new wxStaticBoxSizer(texPropertyBox, wxHORIZONTAL); wxStaticBox* eyePlaneCoeffBox = new wxStaticBox(this, wxID_ANY, wxT("Eye Plane Coefficients"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBoxSizer* eyePlaneCoeffBoxSizer = new wxStaticBoxSizer(eyePlaneCoeffBox, wxHORIZONTAL); wxBoxSizer* eyePlaneLabelSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* eyePlaneTextSizer = new wxBoxSizer(wxVERTICAL); wxStaticText* eyePlaneCoeffLabelS = new wxStaticText(this, wxID_ANY, wxT("GL_S"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* eyePlaneCoeffLabelT = new wxStaticText(this, wxID_ANY, wxT("GL_T"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); eyePlaneCoeffTextS = new wxTextCtrl(this, Id::EyePlaneCoeffValS, FloatToString4(glState->GetTexture(0)->eyePlaneCoeffS), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, wxT("Eye Plane Coefficient S") ); eyePlaneCoeffTextT = new wxTextCtrl(this, Id::EyePlaneCoeffValT, FloatToString4(glState->GetTexture(0)->eyePlaneCoeffT), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, wxT("Eye Plane Coefficient T") ); eyePlaneLabelSizer->Add(eyePlaneCoeffLabelS, 0, wxTOP, TEN_PIXEL_BORDER); eyePlaneLabelSizer->Add(eyePlaneCoeffLabelT, 0, wxTOP, FIFTEEN_PIXEL_BORDER); eyePlaneTextSizer->Add(eyePlaneCoeffTextS, 0, wxALL, FIVE_PIXEL_BORDER); eyePlaneTextSizer->Add(eyePlaneCoeffTextT, 0, wxALL, FIVE_PIXEL_BORDER); eyePlaneCoeffBoxSizer->Add(eyePlaneLabelSizer, 0, wxALL | wxADJUST_MINSIZE, FIVE_PIXEL_BORDER); eyePlaneCoeffBoxSizer->Add(eyePlaneTextSizer, 0, wxALL | wxADJUST_MINSIZE, FIVE_PIXEL_BORDER); wxStaticBox* objectPlaneCoeffBox = new wxStaticBox(this, wxID_ANY, wxT("Object Plane Coefficients"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBoxSizer* objectPlaneCoeffBoxSizer = new wxStaticBoxSizer(objectPlaneCoeffBox, wxHORIZONTAL); wxBoxSizer* objectPlaneLabelSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* objectPlaneTextSizer = new wxBoxSizer(wxVERTICAL); wxStaticText* objectPlaneCoeffLabelS = new wxStaticText(this, wxID_ANY, wxT("GL_S"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* objectPlaneCoeffLabelT = new wxStaticText(this, wxID_ANY, wxT("GL_T"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); objectPlaneCoeffTextS = new wxTextCtrl(this, Id::ObjectPlaneCoeffValS, FloatToString4(glState->GetTexture(0)->objectPlaneCoeffS), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, wxT("Object Plane Coefficient S") ); objectPlaneCoeffTextT = new wxTextCtrl(this, Id::ObjectPlaneCoeffValT, FloatToString4(glState->GetTexture(0)->objectPlaneCoeffT), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, wxT("Object Plane Coefficient T") ); objectPlaneLabelSizer->Add(objectPlaneCoeffLabelS, 0, wxTOP, TEN_PIXEL_BORDER); objectPlaneLabelSizer->Add(objectPlaneCoeffLabelT, 0, wxTOP, FIFTEEN_PIXEL_BORDER); objectPlaneTextSizer->Add(objectPlaneCoeffTextS, 0, wxALL, FIVE_PIXEL_BORDER); objectPlaneTextSizer->Add(objectPlaneCoeffTextT, 0, wxALL, FIVE_PIXEL_BORDER); objectPlaneCoeffBoxSizer->Add(objectPlaneLabelSizer, 0, wxALL |wxADJUST_MINSIZE, FIVE_PIXEL_BORDER); objectPlaneCoeffBoxSizer->Add(objectPlaneTextSizer, 0, wxALL | wxADJUST_MINSIZE, FIVE_PIXEL_BORDER); wxBoxSizer* coeffSizer = new wxBoxSizer(wxVERTICAL); coeffSizer->Add(eyePlaneCoeffBoxSizer, 0, wxALL | wxADJUST_MINSIZE, FIVE_PIXEL_BORDER); coeffSizer->Add(objectPlaneCoeffBoxSizer, 0, wxALL | wxADJUST_MINSIZE, FIVE_PIXEL_BORDER); wxString texNumArray[5]; texNumArray[0] = wxT("T0"); texNumArray[1] = wxT("T1"); texNumArray[2] = wxT("T2"); texNumArray[3] = wxT("T3"); texNumArray[4] = wxT("T4"); texCoordUnitBox = new wxRadioBox(this, Id::TextureCoordUnit, wxT("Selected Texture Unit"), wxDefaultPosition, wxDefaultSize, 5, texNumArray, 1,wxRA_SPECIFY_ROWS, wxDefaultValidator); tex0TexGenEnableCheckBox = new wxCheckBox(this, Id::Tex0TexGenEnableVal, wxT("T0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex0TexGenEnableCheckBox->SetValue(glState->GetTexture(0)->texGen); tex1TexGenEnableCheckBox = new wxCheckBox(this, Id::Tex1TexGenEnableVal, wxT("T1"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex1TexGenEnableCheckBox->SetValue(glState->GetTexture(1)->texGen); tex2TexGenEnableCheckBox = new wxCheckBox(this, Id::Tex2TexGenEnableVal, wxT("T2"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex2TexGenEnableCheckBox->SetValue(glState->GetTexture(2)->texGen); tex3TexGenEnableCheckBox = new wxCheckBox(this, Id::Tex3TexGenEnableVal, wxT("T3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex3TexGenEnableCheckBox->SetValue(glState->GetTexture(3)->texGen); tex4TexGenEnableCheckBox = new wxCheckBox(this, Id::Tex4TexGenEnableVal, wxT("T4"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex4TexGenEnableCheckBox->SetValue(glState->GetTexture(4)->texGen); wxStaticBox* texGenEnableDisableBox = new wxStaticBox(this, wxID_ANY, wxT("glEnable/glDisable TexGen"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBoxSizer* texGenEnableDisableSizer = new wxStaticBoxSizer(texGenEnableDisableBox, wxHORIZONTAL); texGenEnableDisableSizer->Add(tex0TexGenEnableCheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texGenEnableDisableSizer->Add(tex1TexGenEnableCheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texGenEnableDisableSizer->Add(tex2TexGenEnableCheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texGenEnableDisableSizer->Add(tex3TexGenEnableCheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texGenEnableDisableSizer->Add(tex4TexGenEnableCheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); wxBoxSizer* selectedTextureAndEnableSizer = new wxBoxSizer(wxHORIZONTAL); selectedTextureAndEnableSizer->Add(texGenEnableDisableSizer, 0, wxRIGHT | wxLEFT, SEVEN_PIXEL_BORDER); selectedTextureAndEnableSizer->Add(texCoordUnitBox); textureSizer->Add(selectedTextureAndEnableSizer); wxString coordGenArray[5]; coordGenArray[0] = wxT("GL_OBJECT_LINEAR"); coordGenArray[1] = wxT("GL_EYE_LINEAR"); coordGenArray[2] = wxT("GL_SPHERE_MAP"); coordGenArray[3] = wxT("GL_REFLECTION_MAP"); coordGenArray[4] = wxT("GL_NORMAL_MAP"); coordGenBox = new wxRadioBox(this, Id::TexCoordGen, wxT("Texture Coordinate Generation Method (Vertex Shader)"), wxDefaultPosition, wxDefaultSize, 5, coordGenArray, 1,wxRA_SPECIFY_COLS, wxDefaultValidator); selectedTexPropertiesSizer->Add(coordGenBox, 0 , wxALL , FIVE_PIXEL_BORDER); selectedTexPropertiesSizer->Add(coeffSizer, 0, wxALL, ZERO_PIXEL_BORDER); textureSizer->Add(selectedTexPropertiesSizer, 0, wxALL, FIVE_PIXEL_BORDER); SetAutoLayout(TRUE); SetSizer(textureSizer); textureSizer->SetSizeHints(this); }
void SGOglTextureEnvNBPage::UpdateWidgets() { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); Texture* texture = glState->GetTexture(textureBox->GetSelection()); texChoose->SetSelection(texture->textureCurrentSelection - Id::TexturesStart); if(texture->textureCombineScale < 1.9) { texCombineScaleChoose->SetSelection(COMBINE_SCALE_1_0); } else if(texture->textureCombineScale < 2.9) { texCombineScaleChoose->SetSelection(COMBINE_SCALE_2_0); } else { texCombineScaleChoose->SetSelection(COMBINE_SCALE_4_0); } switch(texture->textureApplicationMethod) { case GL_REPLACE: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_REPLACE); DisableCombine(); break; case GL_MODULATE: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_MODULATE); DisableCombine(); break; case GL_DECAL: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_DECAL); DisableCombine(); break; case GL_BLEND: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_BLEND); DisableCombine(); break; case GL_ADD: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_ADD); DisableCombine(); break; case GL_COMBINE: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_COMBINE); EnableCombine(); break; default: texApplyBox->SetSelection(TEXTURE_APPLICATION_METHOD_MODULATE); DisableCombine(); break; } switch(texture->textureCombineMode) { case GL_REPLACE: texCombineModeChoose->SetSelection(COMBINE_MODE_REPLACE); break; case GL_MODULATE: texCombineModeChoose->SetSelection(COMBINE_MODE_MODULATE); break; case GL_ADD: texCombineModeChoose->SetSelection(COMBINE_MODE_ADD); break; case GL_ADD_SIGNED: texCombineModeChoose->SetSelection(COMBINE_MODE_ADD_SIGNED); break; case GL_INTERPOLATE: texCombineModeChoose->SetSelection(COMBINE_MODE_INTERPOLATE); break; case GL_SUBTRACT: texCombineModeChoose->SetSelection(COMBINE_MODE_SUBTRACT); break; case GL_DOT3_RGB: texCombineModeChoose->SetSelection(COMBINE_MODE_DOT3_RGB); break; default: texCombineModeChoose->SetSelection(COMBINE_MODE_MODULATE); } switch(texture->textureCombineSource0) { case GL_TEXTURE: texCombineSrc0RGBChoose->SetSelection(COMBINE_SOURCE_TEXTURE); break; case GL_CONSTANT: texCombineSrc0RGBChoose->SetSelection(COMBINE_SOURCE_CONSTANT); break; case GL_PRIMARY_COLOR: texCombineSrc0RGBChoose->SetSelection(COMBINE_SOURCE_PRIMARY_COLOR); break; case GL_PREVIOUS: texCombineSrc0RGBChoose->SetSelection(COMBINE_SOURCE_PREVIOUS); break; default: break; } switch(texture->textureCombineSource1) { case GL_TEXTURE: texCombineSrc1RGBChoose->SetSelection(COMBINE_SOURCE_TEXTURE); break; case GL_CONSTANT: texCombineSrc1RGBChoose->SetSelection(COMBINE_SOURCE_CONSTANT); break; case GL_PRIMARY_COLOR: texCombineSrc1RGBChoose->SetSelection(COMBINE_SOURCE_PRIMARY_COLOR); break; case GL_PREVIOUS: texCombineSrc1RGBChoose->SetSelection(COMBINE_SOURCE_PREVIOUS); break; default: break; } switch(texture->textureCombineSource2) { case GL_TEXTURE: texCombineSrc2RGBChoose->SetSelection(COMBINE_SOURCE_TEXTURE); break; case GL_CONSTANT: texCombineSrc2RGBChoose->SetSelection(COMBINE_SOURCE_CONSTANT); break; case GL_PRIMARY_COLOR: texCombineSrc2RGBChoose->SetSelection(COMBINE_SOURCE_PRIMARY_COLOR); break; case GL_PREVIOUS: texCombineSrc2RGBChoose->SetSelection(COMBINE_SOURCE_PREVIOUS); break; default: break; } switch(texture->textureCombineOperand0) { case GL_SRC_COLOR: texCombineOperandArg0Choose->SetSelection(COMBINE_OPERAND_SRC_COLOR); break; case GL_ONE_MINUS_SRC_COLOR: texCombineOperandArg0Choose->SetSelection(COMBINE_OPERAND_ONE_MINUS_SRC_COLOR); break; default: break; } switch(texture->textureCombineOperand1) { case GL_SRC_COLOR: texCombineOperandArg1Choose->SetSelection(COMBINE_OPERAND_SRC_COLOR); break; case GL_ONE_MINUS_SRC_COLOR: texCombineOperandArg1Choose->SetSelection(COMBINE_OPERAND_ONE_MINUS_SRC_COLOR); break; default: break; } switch(texture->textureCombineOperand2) { case GL_SRC_COLOR: texCombineOperandArg2Choose->SetSelection(COMBINE_OPERAND_SRC_COLOR); break; case GL_ONE_MINUS_SRC_COLOR: texCombineOperandArg2Choose->SetSelection(COMBINE_OPERAND_ONE_MINUS_SRC_COLOR); break; default: break; } texEnvColorButton->SetBackgroundColour(ToWxIntColor(glState->GetTexture(textureBox->GetSelection())->texEnvColor)); }
SGOglTextureEnvNBPage::SGOglTextureEnvNBPage(SGOglNotebook* parent, wxWindowID id) :wxPanel(parent,id) { m_parent = parent; SGFixedGLState* glState = m_parent->GetGLState(); wxBoxSizer* texMainSizer = new wxBoxSizer(wxHORIZONTAL); wxStaticBox* texBox = new wxStaticBox(this, wxID_ANY, wxT("Textures"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBox* texPropertyBox = new wxStaticBox(this, wxID_ANY, wxT("Selected Texture Properties"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBoxSizer* textureSizer = new wxStaticBoxSizer(texBox, wxVERTICAL); wxStaticBoxSizer* selectedTexPropertiesSizer = new wxStaticBoxSizer(texPropertyBox, wxHORIZONTAL); wxBoxSizer* texChooseTexEnvColorWithLabelSizer = new wxBoxSizer(wxVERTICAL); wxStaticBox* texEnableDisableBox = new wxStaticBox(this, wxID_ANY, wxT("glEnable/glDisable (Select up to 5 Textures)"), wxDefaultPosition, wxDefaultSize, ZERO_PIXEL_BORDER); wxStaticBoxSizer* texEnableDisableSizer = new wxStaticBoxSizer(texEnableDisableBox, wxHORIZONTAL); wxBoxSizer* texCombineModeScaleBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* texCombineArgLabelBoxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* texCombineSourceBoxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* texCombineOperandBoxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* texCombineOperandSourceBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxStaticBox* texCombineStaticBox = new wxStaticBox(this, wxID_ANY, wxT("GL_COMBINE Parameters"), wxDefaultPosition, wxDefaultSize, FIFTY_PIXEL_BORDER); wxStaticBoxSizer* texCombineStaticBoxSizer= new wxStaticBoxSizer(texCombineStaticBox, wxVERTICAL); wxString texNumArray[5]; texNumArray[0] = wxT("T0"); texNumArray[1] = wxT("T1"); texNumArray[2] = wxT("T2"); texNumArray[3] = wxT("T3"); texNumArray[4] = wxT("T4"); textureBox = new wxRadioBox(this, Id::TextureNum, wxT("Selected Texture Unit"), wxDefaultPosition, wxDefaultSize, 5, texNumArray, 1,wxRA_SPECIFY_ROWS, wxDefaultValidator); wxString texChooseArray[Id::NumTextures]; texChooseArray[0] = wxT("3Dlabs"); texChooseArray[1] = wxT("3Dlabs Normal"); texChooseArray[2] = wxT("Rust"); texChooseArray[3] = wxT("Leopard"); texChooseArray[4] = wxT("Eyeball"); texChooseArray[5] = wxT("CobbleStone"); texChooseArray[6] = wxT("CobbleStone Normal"); texChooseArray[7] = wxT("Bricks"); texChooseArray[8] = wxT("Bricks Normal"); texChooseArray[9] = wxT("Stone Wall"); texChooseArray[10] = wxT("Stone Wall Normal"); texChooseArray[11] = wxT("Metal Sheet"); texChooseArray[12] = wxT("Metal Sheet Normal"); texChoose = new wxChoice(this, Id::TextureChoose, wxDefaultPosition, wxDefaultSize, Id::NumTextures, texChooseArray, 0, wxDefaultValidator); texEnvColorButton = new wxButton(this, Id::TexEnvColor, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, wxT("TexEnvColor")); texEnvColorButton->SetBackgroundColour(ToWxIntColor(glState->GetTexture(textureBox->GetSelection())->texEnvColor)); wxStaticText *texEnvButtonLabel = new wxStaticText(this, wxID_ANY, wxT("GL_TEX_ENV_COLOR"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); tex0CheckBox = new wxCheckBox(this, Id::Tex0EnableVal, wxT("T0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex0CheckBox->SetValue(glState->GetTexture(0)->textureEnabled); tex1CheckBox = new wxCheckBox(this, Id::Tex1EnableVal, wxT("T1"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex1CheckBox->SetValue(glState->GetTexture(1)->textureEnabled); tex2CheckBox = new wxCheckBox(this, Id::Tex2EnableVal, wxT("T2"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex2CheckBox->SetValue(glState->GetTexture(2)->textureEnabled); tex3CheckBox = new wxCheckBox(this, Id::Tex3EnableVal, wxT("T3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex3CheckBox->SetValue(glState->GetTexture(3)->textureEnabled); tex4CheckBox = new wxCheckBox(this, Id::Tex4EnableVal, wxT("T4"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); tex4CheckBox->SetValue(glState->GetTexture(4)->textureEnabled); texEnableDisableSizer->Add(tex0CheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texEnableDisableSizer->Add(tex1CheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texEnableDisableSizer->Add(tex2CheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texEnableDisableSizer->Add(tex3CheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); texEnableDisableSizer->Add(tex4CheckBox, 0, wxALL | wxADJUST_MINSIZE, SEVEN_PIXEL_BORDER); wxString texApplyArray[6]; texApplyArray[0] = wxT("GL_REPLACE"); texApplyArray[1] = wxT("GL_MODULATE"); texApplyArray[2] = wxT("GL_DECAL"); texApplyArray[3] = wxT("GL_BLEND"); texApplyArray[4] = wxT("GL_ADD"); texApplyArray[5] = wxT("GL_COMBINE"); texApplyBox = new wxRadioBox(this, Id::TexApply, wxT("Texture Application Method (Fragment Shader)"), wxDefaultPosition, wxDefaultSize, 6, texApplyArray, 1,wxRA_SPECIFY_COLS, wxDefaultValidator); wxString texCombineModeArray[7]; texCombineModeArray[0] = wxT("GL_REPLACE"); texCombineModeArray[1] = wxT("GL_MODULATE"); texCombineModeArray[2] = wxT("GL_ADD"); texCombineModeArray[3] = wxT("GL_ADD_SIGNED"); texCombineModeArray[4] = wxT("GL_INTERPOLATE"); texCombineModeArray[5] = wxT("GL_SUBTRACT"); texCombineModeArray[6] = wxT("GL_DOT3_RGB"); texCombineModeChoose = new wxChoice(this, Id::TextureCombineMode, wxDefaultPosition, wxDefaultSize, 7, texCombineModeArray, 0, wxDefaultValidator); wxStaticText* texCombineModeLabel = new wxStaticText(this, wxID_ANY, wxT("GL_COMBINE_RGB Mode"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* texCombineScaleLabel = new wxStaticText(this, wxID_ANY, wxT("Combine Scale"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxString texCombineScaleArray[3]; texCombineScaleArray[0] = wxT("1.0"); texCombineScaleArray[1] = wxT("2.0"); texCombineScaleArray[2] = wxT("4.0"); texCombineScaleChoose = new wxChoice(this, Id::TextureCombineScale, wxDefaultPosition, wxDefaultSize, 3, texCombineScaleArray, 0, wxDefaultValidator); wxString texCombineSrcnRGBArray[4]; texCombineSrcnRGBArray[0] = wxT("GL_TEXTURE"); texCombineSrcnRGBArray[1] = wxT("GL_CONSTANT"); texCombineSrcnRGBArray[2] = wxT("GL_PRIMARY_COLOR"); texCombineSrcnRGBArray[3] = wxT("GL_PREVIOUS"); texCombineSrc0RGBChoose = new wxChoice(this, Id::TextureCombineSrc0RGB, wxDefaultPosition, wxDefaultSize, 4, texCombineSrcnRGBArray, 0, wxDefaultValidator); texCombineSrc1RGBChoose = new wxChoice(this, Id::TextureCombineSrc1RGB, wxDefaultPosition, wxDefaultSize, 4, texCombineSrcnRGBArray, 0, wxDefaultValidator); texCombineSrc2RGBChoose = new wxChoice(this, Id::TextureCombineSrc2RGB, wxDefaultPosition, wxDefaultSize, 4, texCombineSrcnRGBArray, 0, wxDefaultValidator); wxStaticText* texCombineSrcLabel = new wxStaticText(this, wxID_ANY, wxT("Source"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* texCombineOperandLabel = new wxStaticText(this, wxID_ANY, wxT("Operand"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxString texCombineOperandArray [2]; texCombineOperandArray[0] = wxT("GL_SRC_COLOR"); texCombineOperandArray[1] = wxT("GL_ONE_MINUS_SRC_COLOR"); texCombineOperandArg0Choose = new wxChoice(this, Id::TextureCombineOperandArg0, wxDefaultPosition, wxDefaultSize, 2, texCombineOperandArray, 0, wxDefaultValidator); texCombineOperandArg1Choose = new wxChoice(this, Id::TextureCombineOperandArg1, wxDefaultPosition, wxDefaultSize, 2, texCombineOperandArray, 0, wxDefaultValidator); texCombineOperandArg2Choose = new wxChoice(this, Id::TextureCombineOperandArg2, wxDefaultPosition, wxDefaultSize, 2, texCombineOperandArray, 0, wxDefaultValidator); wxStaticText* texCombineArg0Label = new wxStaticText(this, wxID_ANY, wxT("Arg0"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* texCombineArg1Label = new wxStaticText(this, wxID_ANY, wxT("Arg1"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); wxStaticText* texCombineArg2Label = new wxStaticText(this, wxID_ANY, wxT("Arg2"), wxDefaultPosition, wxDefaultSize, wxALIGN_TOP); texChooseTexEnvColorWithLabelSizer->Add(texEnvButtonLabel, 0, wxALL, FIVE_PIXEL_BORDER); texChooseTexEnvColorWithLabelSizer->Add(texEnvColorButton, 0, wxALL, FIVE_PIXEL_BORDER); texChooseTexEnvColorWithLabelSizer->Add(texChoose, 0, wxALL, FIVE_PIXEL_BORDER); selectedTexPropertiesSizer->Add(texApplyBox, 0 , wxALL , FIVE_PIXEL_BORDER); selectedTexPropertiesSizer->Add(texChooseTexEnvColorWithLabelSizer, 0, wxALL, FIVE_PIXEL_BORDER); texCombineModeScaleBoxSizer->Add(texCombineModeLabel, 0, wxALL, FIVE_PIXEL_BORDER); texCombineModeScaleBoxSizer->Add(texCombineModeChoose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineModeScaleBoxSizer->Add(texCombineScaleLabel, 0, wxALL, FIVE_PIXEL_BORDER); texCombineModeScaleBoxSizer->Add(texCombineScaleChoose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineArgLabelBoxSizer->Add(texCombineArg0Label, 0, wxTOP, TWENTY_PIXEL_BORDER); texCombineArgLabelBoxSizer->Add(texCombineArg1Label, 0, wxTOP, TWENTY_PIXEL_BORDER); texCombineArgLabelBoxSizer->Add(texCombineArg2Label, 0, wxTOP, TWENTY_PIXEL_BORDER); texCombineSourceBoxSizer->Add(texCombineSrcLabel, 0, wxLEFT, FIFTY_PIXEL_BORDER); texCombineSourceBoxSizer->Add(texCombineSrc0RGBChoose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineSourceBoxSizer->Add(texCombineSrc1RGBChoose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineSourceBoxSizer->Add(texCombineSrc2RGBChoose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineOperandBoxSizer->Add(texCombineOperandLabel, 0, wxLEFT, FIFTY_PIXEL_BORDER); texCombineOperandBoxSizer->Add(texCombineOperandArg0Choose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineOperandBoxSizer->Add(texCombineOperandArg1Choose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineOperandBoxSizer->Add(texCombineOperandArg2Choose, 0, wxALL, FIVE_PIXEL_BORDER); texCombineOperandSourceBoxSizer->Add(texCombineArgLabelBoxSizer, 0, wxALL, FIVE_PIXEL_BORDER); texCombineOperandSourceBoxSizer->Add(texCombineSourceBoxSizer, 0, wxALL, FIVE_PIXEL_BORDER); texCombineOperandSourceBoxSizer->Add(texCombineOperandBoxSizer, 0, wxALL, FIVE_PIXEL_BORDER); texCombineStaticBoxSizer->Add(texCombineModeScaleBoxSizer, 0, wxALL, FIVE_PIXEL_BORDER); texCombineStaticBoxSizer->Add(texCombineOperandSourceBoxSizer, 0, wxALL, FIVE_PIXEL_BORDER); textureSizer->Add(texEnableDisableSizer, 0, wxALL, FIVE_PIXEL_BORDER); textureSizer->Add(textureBox, 0, wxALL, FIVE_PIXEL_BORDER); textureSizer->Add(selectedTexPropertiesSizer, 0, wxALL, FIVE_PIXEL_BORDER); texMainSizer->Add(textureSizer, 0, wxALL, FIVE_PIXEL_BORDER); texMainSizer->Add(texCombineStaticBoxSizer, 0, wxALL, FIVE_PIXEL_BORDER); SetAutoLayout(TRUE); SetSizer(texMainSizer); texMainSizer->SetSizeHints( this ); DisableCombine(); UpdateWidgets(); }