static int DO_Printer_postScriptSettings (UiForm *dia, const wchar_t *sendingString_dummy, Interpreter *interpreter_dummy, const wchar_t *invokingButtonTitle, bool modified, void *dummy) { (void) sendingString_dummy; (void) interpreter_dummy; (void) invokingButtonTitle; (void) modified; (void) dummy; #if defined (_WIN32) || defined (macintosh) thePrinter. allowDirectPostScript = GET_INTEGER (L"Allow direct PostScript"); #endif thePrinter. spots = GET_ENUM (kGraphicsPostscript_spots, L"Grey resolution"); #if defined (UNIX) thePrinter. paperSize = GET_ENUM (kGraphicsPostscript_paperSize, L"Paper size"); if (thePrinter. paperSize == kGraphicsPostscript_paperSize_A3) { thePrinter. paperWidth = 842 * thePrinter. resolution / 72; thePrinter. paperHeight = 1191 * thePrinter. resolution / 72; } else if (thePrinter. paperSize == kGraphicsPostscript_paperSize_US_LETTER) { thePrinter. paperWidth = 612 * thePrinter. resolution / 72; thePrinter. paperHeight = 792 * thePrinter. resolution / 72; } else { thePrinter. paperWidth = 595 * thePrinter. resolution / 72; thePrinter. paperHeight = 842 * thePrinter. resolution / 72; } thePrinter. orientation = GET_ENUM (kGraphicsPostscript_orientation, L"Orientation"); thePrinter. magnification = GET_REAL (L"Magnification"); Site_setPrintCommand (GET_STRING (L"printCommand")); #endif thePrinter. fontChoiceStrategy = GET_ENUM (kGraphicsPostscript_fontChoiceStrategy, L"Font choice strategy"); #if defined (macintosh) thePrinter. epsFilesHavePreview = GET_INTEGER (L"EPS files include preview"); #endif return 1; }
static int GetWindowAttrib(lua_State *L) { win_t *win = checkwindow(L, 1); int attrib = checktarget(L, 2); switch(attrib) { case GLFW_FOCUSED: case GLFW_ICONIFIED: case GLFW_VISIBLE: case GLFW_RESIZABLE: case GLFW_DECORATED: case GLFW_FLOATING: case GLFW_MAXIMIZED: case GLFW_CENTER_CURSOR: case GLFW_TRANSPARENT_FRAMEBUFFER: case GLFW_HOVERED: case GLFW_FOCUS_ON_SHOW: case GLFW_SCALE_TO_MONITOR: return GetBoolean(L, win->window, attrib); case GLFW_CLIENT_API: GET_ENUM(L, win->window, attrib, pushapi); case GLFW_CONTEXT_CREATION_API: GET_ENUM(L, win->window, attrib, pushcontextcreationapi); case GLFW_CONTEXT_VERSION_MAJOR: case GLFW_CONTEXT_VERSION_MINOR: case GLFW_CONTEXT_REVISION: return GetInteger(L, win->window, attrib); case GLFW_OPENGL_FORWARD_COMPAT: case GLFW_OPENGL_DEBUG_CONTEXT: return GetBoolean(L, win->window, attrib); case GLFW_OPENGL_PROFILE: GET_ENUM(L, win->window, attrib, pushprofile); case GLFW_CONTEXT_ROBUSTNESS: GET_ENUM(L, win->window, attrib, pushrobustness); case GLFW_CONTEXT_RELEASE_BEHAVIOR: GET_ENUM(L, win->window, attrib, pushreleasebehavior); default: return luaL_error(L, "invalid attribute '%s'", lua_tostring(L, 2)); } return 0; }
vogleditor_stateTreeRenderbufferItem::vogleditor_stateTreeRenderbufferItem(QString name, GLuint64 handle, vogleditor_stateTreeItem *parent, const vogl_renderbuffer_state &state) : vogleditor_stateTreeItem(name, "", parent), m_handle(handle), m_pState(&state), m_pDiffBaseState(NULL) { const vogl_renderbuffer_desc &rDesc = m_pState->get_desc(); int val = 0; #define GET_INT(name) \ if (rDesc.get_int(name, &val, 1)) \ { \ vogleditor_stateTreeRenderbufferIntItem *pItem = new vogleditor_stateTreeRenderbufferIntItem(#name, name, this, state); \ this->appendChild(pItem); \ m_diffableItems.push_back(pItem); \ } #define GET_ENUM(name) \ if (rDesc.get_int(name, &val, 1)) \ { \ vogleditor_stateTreeRenderbufferEnumItem *pItem = new vogleditor_stateTreeRenderbufferEnumItem(#name, name, this, state); \ this->appendChild(pItem); \ m_diffableItems.push_back(pItem); \ } GET_INT(GL_RENDERBUFFER_WIDTH); GET_INT(GL_RENDERBUFFER_HEIGHT); GET_INT(GL_RENDERBUFFER_SAMPLES); GET_ENUM(GL_RENDERBUFFER_INTERNAL_FORMAT); GET_INT(GL_RENDERBUFFER_RED_SIZE); GET_INT(GL_RENDERBUFFER_GREEN_SIZE); GET_INT(GL_RENDERBUFFER_BLUE_SIZE); GET_INT(GL_RENDERBUFFER_ALPHA_SIZE); GET_INT(GL_RENDERBUFFER_DEPTH_SIZE); GET_INT(GL_RENDERBUFFER_STENCIL_SIZE); #undef GET_INT #undef GET_ENUM // { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_PROGRAM_ENV_PARAMETERS_ARB GL_VERTEX_PROGRAM_ARB", &vogl_context_info::get_max_arb_vertex_program_env_params, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); } // { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_PROGRAM_ENV_PARAMETERS_ARB GL_FRAGMENT_PROGRAM_ARB", &vogl_context_info::get_max_arb_fragment_program_env_params, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); } // { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_PROGRAM_MATRICES_ARB", &vogl_context_info::get_max_arb_program_matrices, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); } // { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_COMBINED_TEXTURE_COORDS", &vogl_context_info::get_max_combined_texture_coords, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); } // { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", &vogl_context_info::get_max_transform_feedback_separate_attribs, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); } }
static void menu_cb_soundScaling (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Sound scaling", nullptr) OPTIONMENU_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my default_sound_scalingStrategy ()) LABEL (U"", U"For \"fixed height\":"); POSITIVE (U"Height", my default_sound_scaling_height ()) LABEL (U"", U"For \"fixed range\":"); REAL (U"Minimum", my default_sound_scaling_minimum ()) REAL (U"Maximum", my default_sound_scaling_maximum ()) EDITOR_OK SET_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my p_sound_scalingStrategy) SET_REAL (U"Height", my p_sound_scaling_height) SET_REAL (U"Minimum", my p_sound_scaling_minimum) SET_REAL (U"Maximum", my p_sound_scaling_maximum) EDITOR_DO my pref_sound_scalingStrategy () = my p_sound_scalingStrategy = GET_ENUM (kTimeSoundEditor_scalingStrategy, U"Scaling strategy"); my pref_sound_scaling_height () = my p_sound_scaling_height = GET_REAL (U"Height"); my pref_sound_scaling_minimum () = my p_sound_scaling_minimum = GET_REAL (U"Minimum"); my pref_sound_scaling_maximum () = my p_sound_scaling_maximum = GET_REAL (U"Maximum"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_ExtractSelectedSound_windowed (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Extract selected sound (windowed)", nullptr) WORD (U"Name", U"slice") OPTIONMENU_ENUM (U"Window shape", kSound_windowShape, my default_extract_windowShape ()) POSITIVE (U"Relative width", my default_extract_relativeWidth ()) BOOLEAN (U"Preserve times", my default_extract_preserveTimes ()) EDITOR_OK SET_ENUM (U"Window shape", kSound_windowShape, my pref_extract_windowShape ()) SET_REAL (U"Relative width", my pref_extract_relativeWidth ()) SET_INTEGER (U"Preserve times", my pref_extract_preserveTimes ()) EDITOR_DO Sound sound = my d_sound.data; Melder_assert (sound); my pref_extract_windowShape () = GET_ENUM (kSound_windowShape, U"Window shape"); my pref_extract_relativeWidth () = GET_REAL (U"Relative width"); my pref_extract_preserveTimes () = GET_INTEGER (U"Preserve times"); autoSound extract = Sound_extractPart (sound, my d_startSelection, my d_endSelection, my pref_extract_windowShape (), my pref_extract_relativeWidth (), my pref_extract_preserveTimes ()); Thing_setName (extract.peek(), GET_STRING (U"Name")); Editor_broadcastPublication (me, extract.transfer()); EDITOR_END }
static void menu_cb_learnOneFromPartialOutput (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Learn one from partial adult output", 0) LABEL (U"", U"Partial adult surface form (e.g. overt form):") SENTENCE (U"Partial output", U"") REAL (U"Evaluation noise", U"2.0") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") BOOLEAN (U"Honour local rankings", 1) NATURAL (U"Number of chews", U"1") EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one from partial output"); OTGrammar_learnOneFromPartialOutput ((OTGrammar) my data, GET_STRING (U"Partial output"), GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), GET_INTEGER (U"Number of chews"), TRUE); OTGrammar_sort ((OTGrammar) my data); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_learnOne (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...") LABEL (U"", U"Underlying form:") SENTENCE (U"Input string", U"") LABEL (U"", U"Adult surface form:") SENTENCE (U"Output string", U"") REAL (U"Evaluation noise", U"2.0") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") BOOLEAN (U"Honour local rankings", 1) EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one"); OTGrammar_learnOne ((OTGrammar) my data, GET_STRING (U"Input string"), GET_STRING (U"Output string"), GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), TRUE, TRUE, NULL); OTGrammar_sort ((OTGrammar) my data); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_learnOne (EDITOR_ARGS) { EDITOR_IAM (OTMultiEditor); EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) OPTIONMENU (U"Direction", 3) OPTION (U"forward") OPTION (U"backward") OPTION (U"bidirectionally") REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one"); Melder_free (my form1); Melder_free (my form2); my form1 = GuiText_getString (my form1Text); my form2 = GuiText_getString (my form2Text); OTMulti_learnOne ((OTMulti) my data, my form1, my form2, GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Direction"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading")); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
vogleditor_stateTreeTexEnvItem::vogleditor_stateTreeTexEnvItem(QString name, vogleditor_stateTreeItem *parent, vogl_texenv_state &state, const vogl_context_info &info) : vogleditor_stateTreeItem(name, "", parent), m_pState(&state), m_pDiffBaseState(NULL), m_pDiffBaseInfo(NULL) { QString tmp; for (uint texcoord_index = 0; texcoord_index < info.get_max_texture_coords(); texcoord_index++) { vogleditor_stateTreeItem *pTexNode = new vogleditor_stateTreeItem(tmp.sprintf("GL_TEXTURE%u", texcoord_index), "", this); this->appendChild(pTexNode); int iVals[4] = { 0, 0, 0, 0 }; float fVals[4] = { 0, 0, 0, 0 }; #define GET_ENUM(target, idx, name, num) \ if (m_pState->get_state(target).get<int>(name, idx, iVals, num)) \ { \ vogleditor_stateTreeTexEnvStateVecEnumItem *pItem = new vogleditor_stateTreeTexEnvStateVecEnumItem(target, #name, name, idx, iVals, num, pTexNode, *m_pState); \ m_diffableItems.push_back(pItem); \ pTexNode->appendChild(pItem); \ } #define GET_FLOAT(target, idx, name, num) \ if (m_pState->get_state(target).get<float>(name, idx, fVals, num)) \ { \ vogleditor_stateTreeTexEnvStateVecFloatItem *pItem = new vogleditor_stateTreeTexEnvStateVecFloatItem(target, #name, name, idx, fVals, num, pTexNode, *m_pState); \ m_diffableItems.push_back(pItem); \ pTexNode->appendChild(pItem); \ } GET_FLOAT(GL_TEXTURE_FILTER_CONTROL, texcoord_index, GL_TEXTURE_LOD_BIAS, 1); GET_ENUM(GL_POINT_SPRITE, texcoord_index, GL_COORD_REPLACE, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_TEXTURE_ENV_MODE, 1); GET_FLOAT(GL_TEXTURE_ENV, texcoord_index, GL_TEXTURE_ENV_COLOR, 4); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_COMBINE_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_COMBINE_ALPHA, 1); GET_FLOAT(GL_TEXTURE_ENV, texcoord_index, GL_RGB_SCALE, 1); GET_FLOAT(GL_TEXTURE_ENV, texcoord_index, GL_ALPHA_SCALE, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_SRC0_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_SRC1_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_SRC2_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_SRC0_ALPHA, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_SRC1_ALPHA, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_SRC2_ALPHA, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_OPERAND0_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_OPERAND1_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_OPERAND2_RGB, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_OPERAND0_ALPHA, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_OPERAND1_ALPHA, 1); GET_ENUM(GL_TEXTURE_ENV, texcoord_index, GL_OPERAND2_ALPHA, 1); // TODO: //{ "glGetTexEnv", 'E', 1, "GL_SOURCE3_RGB_NV", 0x8583}, //{ "glGetTexEnv", 'E', 1, "GL_SOURCE3_ALPHA_NV", 0x858B}, //{ "glGetTexEnv", 'E', 1, "GL_OPERAND3_RGB_NV", 0x8593}, //{ "glGetTexEnv", 'E', 1, "GL_OPERAND3_ALPHA_NV", 0x859B}, //{ "glGetTexEnv", 'E', 1, "GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV", 0x86D9}, //{ "glGetTexEnv", 'E', 1, "GL_SHADER_OPERATION_NV", 0x86DF}, //{ "glGetTexEnv", 'E', 4, "GL_CULL_MODES_NV", 0x86E0}, //{ "glGetTexEnv", 'F', 4, "GL_OFFSET_TEXTURE_MATRIX_NV", 0x86E1}, //{ "glGetTexEnv", 'F', 1, "GL_OFFSET_TEXTURE_SCALE_NV", 0x86E2}, //{ "glGetTexEnv", 'F', 1, "GL_OFFSET_TEXTURE_BIAS_NV", 0x86E3}, //{ "glGetTexEnv", 'E', 1, "GL_PREVIOUS_TEXTURE_INPUT_NV", 0x86E4}, //{ "glGetTexEnv", 'F', 3, "GL_CONST_EYE_NV", 0x86E5}, //{ "glGetTexEnv", 'E', 1, "GL_BUMP_TARGET_ATI", 0x877C}, #undef GET_FLOAT #undef GET_ENUM #define GET_ENUM(target, idx, name, num) \ if (m_pState->get_state(target).get<int>(name, idx, iVals, num)) \ { \ vogleditor_stateTreeTexEnvStateVecEnumItem *pItem = new vogleditor_stateTreeTexEnvStateVecEnumItem(target, #target " " #name, name, idx, iVals, num, pTexNode, *m_pState); \ m_diffableItems.push_back(pItem); \ pTexNode->appendChild(pItem); \ } #define GET_FLOAT(target, idx, name, num) \ if (m_pState->get_state(target).get<float>(name, idx, fVals, num)) \ { \ vogleditor_stateTreeTexEnvStateVecFloatItem *pItem = new vogleditor_stateTreeTexEnvStateVecFloatItem(target, #target " " #name, name, idx, fVals, num, pTexNode, *m_pState); \ m_diffableItems.push_back(pItem); \ pTexNode->appendChild(pItem); \ } GET_ENUM(GL_S, texcoord_index, GL_TEXTURE_GEN_MODE, 1); GET_FLOAT(GL_S, texcoord_index, GL_OBJECT_PLANE, 4); GET_FLOAT(GL_S, texcoord_index, GL_EYE_PLANE, 4); GET_ENUM(GL_T, texcoord_index, GL_TEXTURE_GEN_MODE, 1); GET_FLOAT(GL_T, texcoord_index, GL_OBJECT_PLANE, 4); GET_FLOAT(GL_T, texcoord_index, GL_EYE_PLANE, 4); GET_ENUM(GL_R, texcoord_index, GL_TEXTURE_GEN_MODE, 1); GET_FLOAT(GL_R, texcoord_index, GL_OBJECT_PLANE, 4); GET_FLOAT(GL_R, texcoord_index, GL_EYE_PLANE, 4); GET_ENUM(GL_Q, texcoord_index, GL_TEXTURE_GEN_MODE, 1); GET_FLOAT(GL_Q, texcoord_index, GL_OBJECT_PLANE, 4); GET_FLOAT(GL_Q, texcoord_index, GL_EYE_PLANE, 4); #undef GET_FLOAT #undef GET_ENUM } }
praat_new (thee.transfer(), my name, L"_mean"); } END /***** ERPTier & Table *****/ FORM (ERPTier_Table_extractEventsWhereColumn_number, L"Extract events where column (number)", 0) WORD (L"Extract all events where column...", L"") RADIO_ENUM (L"...is...", kMelder_number, DEFAULT) REAL (L"...the number", L"0.0") OK DO ERPTier erpTier = FIRST (ERPTier); Table table = FIRST (Table); long columnNumber = Table_getColumnIndexFromColumnLabel (table, GET_STRING (L"Extract all events where column...")); autoERPTier thee = erpTier -> f_extractEventsWhereColumn_number (table, columnNumber, GET_ENUM (kMelder_number, L"...is..."), GET_REAL (L"...the number")); praat_new (thee.transfer(), erpTier -> name); END FORM (ERPTier_Table_extractEventsWhereColumn_text, L"Extract events where column (text)", 0) WORD (L"Extract all events where column...", L"") OPTIONMENU_ENUM (L"...", kMelder_string, DEFAULT) SENTENCE (L"...the text", L"hi") OK DO ERPTier erpTier = FIRST (ERPTier); Table table = FIRST (Table); long columnNumber = Table_getColumnIndexFromColumnLabel (table, GET_STRING (L"Extract all events where column...")); autoERPTier thee = erpTier -> f_extractEventsWhereColumn_string (table, columnNumber, GET_ENUM (kMelder_string, L"..."), GET_STRING (L"...the text")); praat_new (thee.transfer(), erpTier -> name); END
LOOP { iam (ERP); ERP_drawScalp (me, GRAPHICS, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"), GET_REAL (U"left Voltage range"), GET_REAL (U"right Voltage range"), GET_ENUM (kGraphics_colourScale, U"Colour scale"), GET_INTEGER (U"Garnish")); } END2 } FORM (ERP_drawScalp_garnish, U"ERP: Draw scalp (garnish)", nullptr) { REAL (U"left Voltage range (V)", U"10e-6") REAL (U"right Voltage range", U"-10e-6") RADIO_ENUM (U"Colour scale", kGraphics_colourScale, BLUE_TO_RED) OK2 DO autoPraatPicture picture; ERP_drawScalp_garnish (GRAPHICS, GET_REAL (U"left Voltage range"), GET_REAL (U"right Voltage range"), GET_ENUM (kGraphics_colourScale, U"Colour scale")); END2 } FORM (ERP_extractOneChannelAsSound, U"ERP: Extract one channel as Sound", nullptr) { WORD (U"Channel name", U"Cz") OK2 DO LOOP { iam (ERP); const char32 *channelName = GET_STRING (U"Channel name"); long channelNumber = ERP_getChannelNumber (me, channelName); if (channelNumber == 0) Melder_throw (me, U": no channel named \"", channelName, U"\"."); autoSound thee = Sound_extractChannel (me, channelNumber); praat_new (thee.move(), my name, U"_", channelName); } END2 }
vogleditor_stateTreeTextureItem::vogleditor_stateTreeTextureItem(QString name, QString value, vogleditor_stateTreeItem* parentNode, vogl_texture_state* pState, const vogl_context_info& info) : vogleditor_stateTreeItem(name, value, parentNode), m_pTexture(pState), m_pDiffBaseState(NULL) { QString tmp; float fVals[16]; int iVals[16]; #define STR_INT1(val) tmp.sprintf("%d", val[0]) #define GET_INT(name, num) if (m_pTexture->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecIntItem* pItem = new vogleditor_stateTreeStateVecIntItem(#name, name, 0, m_pTexture->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); } #define GET_ENUM(name, num) if (m_pTexture->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecEnumItem* pItem = new vogleditor_stateTreeStateVecEnumItem(#name, name, 0, m_pTexture->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); } #define GET_FLOAT(name, num) if (m_pTexture->get_params().get<float>(name, 0, fVals, num)) { vogleditor_stateTreeStateVecFloatItem* pItem = new vogleditor_stateTreeStateVecFloatItem(#name, name, 0, m_pTexture->get_params(), fVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); } GET_INT(GL_TEXTURE_BASE_LEVEL, 1); int base_level = iVals[0]; GET_INT(GL_TEXTURE_MAX_LEVEL, 1); GET_FLOAT(GL_TEXTURE_BORDER_COLOR, 4); GET_ENUM(GL_TEXTURE_COMPARE_MODE, 1); GET_ENUM(GL_TEXTURE_COMPARE_FUNC, 1); GET_FLOAT(GL_TEXTURE_LOD_BIAS, 1); GET_ENUM(GL_TEXTURE_MIN_FILTER, 1); GET_ENUM(GL_TEXTURE_MAG_FILTER, 1); GET_FLOAT(GL_TEXTURE_MIN_LOD, 1); GET_FLOAT(GL_TEXTURE_MAX_LOD, 1); GET_ENUM(GL_TEXTURE_SWIZZLE_R, 1); GET_ENUM(GL_TEXTURE_SWIZZLE_G, 1); GET_ENUM(GL_TEXTURE_SWIZZLE_B, 1); GET_ENUM(GL_TEXTURE_SWIZZLE_A, 1); GET_ENUM(GL_TEXTURE_SWIZZLE_RGBA, 4); GET_ENUM(GL_TEXTURE_WRAP_S, 1); GET_ENUM(GL_TEXTURE_WRAP_T, 1); GET_ENUM(GL_TEXTURE_WRAP_R, 1); if (!info.is_core_profile()) { GET_ENUM(GL_GENERATE_MIPMAP, 1); } GET_INT(GL_TEXTURE_IMMUTABLE_FORMAT, 1); if (info.supports_extension("GL_EXT_texture_filter_anisotropic")) { GET_FLOAT(GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); } if (info.supports_extension("GL_EXT_texture_sRGB_decode")) { GET_ENUM(GL_TEXTURE_SRGB_DECODE_EXT, 1); } if (!info.is_core_profile() && info.supports_extension("GL_ARB_shadow_ambient")) { GET_FLOAT(GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 1); } if (!info.is_core_profile()) { GET_ENUM(GL_DEPTH_TEXTURE_MODE, 1); // TODO //GL_TEXTURE_PRIORITY //GL_TEXTURE_RESIDENT } int num_actual_levels = m_pTexture->get_num_levels(); uint num_faces = (m_pTexture->get_target() == GL_TEXTURE_CUBE_MAP) ? 6 : 1; for (uint face = 0; face < num_faces; face++) { GLenum face_target_to_query = m_pTexture->get_target(); if (m_pTexture->get_target() == GL_TEXTURE_CUBE_MAP) face_target_to_query = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face; vogleditor_stateTreeItem* pFaceNode = this; if (m_pTexture->get_target() == GL_TEXTURE_CUBE_MAP) { pFaceNode = new vogleditor_stateTreeItem(enum_to_string(face_target_to_query), "", this); this->appendChild(pFaceNode); } for (int level = base_level; level < num_actual_levels; level++) { vogleditor_stateTreeItem* pLevelNode = new vogleditor_stateTreeItem(tmp.sprintf("Mip level %d", level), "", pFaceNode); pFaceNode->appendChild(pLevelNode); const vogl_state_vector& level_params = m_pTexture->get_level_params(face, level); // TODO: Check for core vs. compat profiles and not query the old stuff #undef GET_INT #undef GET_ENUM #define GET_INT(name, num) if (level_params.get<int>(name, 0, iVals, num)) { pLevelNode->appendChild(new vogleditor_stateTreeStateVecIntItem(#name, name, 0, level_params, iVals, num, false, pLevelNode)); } #define GET_ENUM(name, num) if (level_params.get<int>(name, 0, iVals, num)) { pLevelNode->appendChild(new vogleditor_stateTreeStateVecEnumItem(#name, name, 0, level_params, iVals, num, false, pLevelNode)); } GET_INT(GL_TEXTURE_WIDTH, 1); GET_INT(GL_TEXTURE_HEIGHT, 1); GET_INT(GL_TEXTURE_DEPTH, 1); GET_ENUM(GL_TEXTURE_INTERNAL_FORMAT, 1); GET_INT(GL_TEXTURE_SAMPLES, 1); GET_ENUM(GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, 1); GET_INT(GL_TEXTURE_RED_SIZE, 1); GET_INT(GL_TEXTURE_GREEN_SIZE, 1); GET_INT(GL_TEXTURE_BLUE_SIZE, 1); GET_INT(GL_TEXTURE_ALPHA_SIZE, 1); GET_INT(GL_TEXTURE_DEPTH_SIZE, 1); GET_INT(GL_TEXTURE_STENCIL_SIZE, 1); GET_INT(GL_TEXTURE_LUMINANCE_SIZE, 1); GET_INT(GL_TEXTURE_INTENSITY_SIZE, 1); GET_INT(GL_TEXTURE_SHARED_SIZE, 1); GET_INT(GL_TEXTURE_COMPRESSED, 1); bool is_compressed = (bool)iVals[0]; if (info.supports_extension("GL_ARB_depth_texture")) { GET_INT(GL_TEXTURE_DEPTH_SIZE, 1); GET_INT(GL_TEXTURE_DEPTH_TYPE, 1); } if (info.supports_extension("GL_EXT_packed_depth_stencil")) GET_INT(GL_TEXTURE_STENCIL_SIZE_EXT, 1); if (m_pTexture->get_target() == GL_TEXTURE_BUFFER) { GET_INT(GL_TEXTURE_BUFFER_DATA_STORE_BINDING, 1); GET_INT(GL_TEXTURE_BUFFER_OFFSET, 1); GET_INT(GL_TEXTURE_BUFFER_SIZE, 1); } if (is_compressed) { GET_INT(GL_TEXTURE_COMPRESSED_IMAGE_SIZE, 1); } } } #undef GET_FLOAT #undef GET_ENUM #undef GET_INT }