Line data Source code
1 0 : /* 2 : 3 : OOMaterialSpecifier.h 4 : 5 : Key declarations and convenience methods for material specifiers. 6 : 7 : 8 : Copyright (C) 2010-2013 Jens Ayton 9 : 10 : Permission is hereby granted, free of charge, to any person obtaining a copy 11 : of this software and associated documentation files (the "Software"), to deal 12 : in the Software without restriction, including without limitation the rights 13 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 : copies of the Software, and to permit persons to whom the Software is 15 : furnished to do so, subject to the following conditions: 16 : 17 : The above copyright notice and this permission notice shall be included in all 18 : copies or substantial portions of the Software. 19 : 20 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 : SOFTWARE. 27 : 28 : */ 29 : 30 : #import "OOCocoa.h" 31 : 32 : @class OOColor; 33 : 34 : 35 : // Convenience methods to extract properties from material dictionaries. 36 : @interface NSDictionary (OOMateralProperties) 37 : 38 0 : - (OOColor *) oo_diffuseColor; 39 0 : - (OOColor *) oo_ambientColor; 40 0 : - (OOColor *) oo_specularColor; 41 0 : - (OOColor *) oo_specularModulateColor; 42 0 : - (OOColor *) oo_emissionColor; 43 0 : - (OOColor *) oo_emissionModulateColor; 44 0 : - (OOColor *) oo_illuminationModulateColor; 45 : 46 0 : - (NSDictionary *) oo_diffuseMapSpecifierWithDefaultName:(NSString *)name; 47 0 : - (NSDictionary *) oo_combinedSpecularMapSpecifier; 48 0 : - (NSDictionary *) oo_specularColorMapSpecifier; 49 0 : - (NSDictionary *) oo_specularExponentMapSpecifier; 50 0 : - (NSDictionary *) oo_normalMapSpecifier; 51 0 : - (NSDictionary *) oo_parallaxMapSpecifier; 52 0 : - (NSDictionary *) oo_normalAndParallaxMapSpecifier; 53 0 : - (NSDictionary *) oo_emissionMapSpecifier; 54 0 : - (NSDictionary *) oo_illuminationMapSpecifier; 55 0 : - (NSDictionary *) oo_emissionAndIlluminationMapSpecifier; 56 : 57 0 : - (float) oo_parallaxScale; 58 0 : - (float) oo_parallaxBias; 59 : 60 0 : - (BOOL) oo_gammaCorrect; 61 : 62 0 : - (float) oo_gloss; 63 : 64 0 : - (int) oo_specularExponent; 65 : 66 : @end 67 : 68 : 69 0 : extern NSString * const kOOMaterialDiffuseColorName; 70 0 : extern NSString * const kOOMaterialDiffuseColorLegacyName; 71 0 : extern NSString * const kOOMaterialAmbientColorName; 72 0 : extern NSString * const kOOMaterialAmbientColorLegacyName; 73 0 : extern NSString * const kOOMaterialSpecularColorName; 74 0 : extern NSString * const kOOMaterialSpecularColorLegacyName; 75 0 : extern NSString * const kOOMaterialSpecularModulateColorName; 76 0 : extern NSString * const kOOMaterialEmissionColorName; 77 0 : extern NSString * const kOOMaterialEmissionColorLegacyName; 78 0 : extern NSString * const kOOMaterialEmissionModulateColorName; 79 0 : extern NSString * const kOOMaterialIlluminationModulateColorName; 80 : 81 0 : extern NSString * const kOOMaterialDiffuseMapName; 82 0 : extern NSString * const kOOMaterialSpecularColorMapName; 83 0 : extern NSString * const kOOMaterialSpecularExponentMapName; 84 0 : extern NSString * const kOOMaterialCombinedSpecularMapName; 85 0 : extern NSString * const kOOMaterialNormalMapName; 86 0 : extern NSString * const kOOMaterialParallaxMapName; 87 0 : extern NSString * const kOOMaterialNormalAndParallaxMapName; 88 0 : extern NSString * const kOOMaterialEmissionMapName; 89 0 : extern NSString * const kOOMaterialIlluminationMapName; 90 0 : extern NSString * const kOOMaterialEmissionAndIlluminationMapName; 91 : 92 0 : extern NSString * const kOOMaterialParallaxScaleName; 93 0 : extern NSString * const kOOMaterialParallaxBiasName; 94 : 95 0 : extern NSString * const kOOMaterialGammaCorrectName; 96 : 97 0 : extern NSString * const kOOMaterialGlossName; 98 : 99 0 : extern NSString * const kOOMaterialSpecularExponentName; 100 0 : extern NSString * const kOOMaterialSpecularExponentLegacyName; 101 : 102 0 : extern NSString * const kOOMaterialLightMapsName; 103 : 104 0 : #define kOOMaterialDefaultParallaxScale (0.01f)