Skip to content
Snippets Groups Projects
Commit 08b08754 authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Added functions to NiTexturingProperty.

Enabled precompiled headers in MS Visual C++ project.  Also tried some tweaked optimization settings to make it compile faster.
parent f7a84c06
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,8 @@ enum TexType {
GLOSS_MAP = 3, /*!< Allows the glossyness of an object to differ across its surface. */
GLOW_MAP = 4, /*!< Creates a glowing effect. */
BUMP_MAP = 5, /*!< Used to make the object appear to have more detail than it really does. */
DECAL_0_MAP = 6 /*!< For placing images on the object like stickers. */
DECAL_0_MAP = 6, /*!< For placing images on the object like stickers. */
DECAL_1_MAP = 7 /*!< For placing images on the object like stickers. */
};
/*! Specifies the availiable texture apply modes. Affects the way colors are composed together. */
......
......@@ -85,6 +85,7 @@
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
......@@ -103,9 +104,12 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/FI&quot;pch.h&quot;"
Optimization="3"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pch.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
......@@ -228,6 +232,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pch.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Type.cpp"
>
......@@ -1230,6 +1246,10 @@
RelativePath=".\niflib.h"
>
</File>
<File
RelativePath=".\pch.h"
>
</File>
<File
RelativePath=".\Ref.h"
>
......
......@@ -53,3 +53,173 @@ const Type & NiTexturingProperty::GetType() const {
return TYPE;
};
ApplyMode NiTexturingProperty::GetApplyMode() const {
return applyMode;
}
void NiTexturingProperty::SetApplyMode( ApplyMode new_val ) {
applyMode = new_val;
}
int NiTexturingProperty::GetTextureCount() const {
//TODO: Create a built in type for this array of textures so it can be a real array again?
int count = 0;
if ( hasBaseTexture ) { count++; }
if ( hasBumpMapTexture ) { count++; }
if ( hasDarkTexture ) { count++; }
if ( hasDecal0Texture ) { count++; }
if ( hasDecal1Texture ) { count++; }
if ( hasDetailTexture ) { count++; }
if ( hasGlossTexture ) { count++; }
if ( hasGlowTexture ) { count++; }
return count;
}
int NiTexturingProperty::GetShaderTextureCount() const {
return int(shaderTextures.size());
}
TexDesc NiTexturingProperty::GetTexture( int n ) const {
//TODO: Create a built in type for this array of textures so it can be a real array again?
//Copy the values to the right texture
switch (n) {
case BASE_MAP:
return baseTexture;
case DARK_MAP:
return darkTexture;
case DETAIL_MAP:
return detailTexture;
case GLOSS_MAP:
return glossTexture;
case GLOW_MAP:
return glowTexture;
case BUMP_MAP:
return bumpMapTexture;
case DECAL_0_MAP:
return decal0Texture;
case DECAL_1_MAP:
return decal1Texture;
};
}
TexDesc NiTexturingProperty::GetShaderTexture( int n ) const {
return shaderTextures[n].textureData;
}
float NiTexturingProperty::GetLumaOffset() const {
return bumpMapLumaOffset;
}
void NiTexturingProperty::SetLumaOffset( float new_val ) {
bumpMapLumaOffset = new_val;
}
float NiTexturingProperty::GetLumaScale() const {
return bumpMapLumaScale;
}
void NiTexturingProperty::SetLumaScale( float new_val ) {
bumpMapLumaScale = new_val;
}
Matrix22 NiTexturingProperty::GetBumpMapMatrix() const {
return bumpMapMatrix;
}
void NiTexturingProperty::SetBumpMapMatrix( Matrix22 & new_val ) {
bumpMapMatrix = new_val;
}
void NiTexturingProperty::SetTextureCount( int new_count ) {
if ( new_count < int(textureCount) ) {
for ( int i = int(textureCount); i > new_count; --i ) {
switch (i) {
case BASE_MAP:
hasBaseTexture = false;
baseTexture.source = NULL;
break;
case DARK_MAP:
hasDarkTexture = false;
darkTexture.source = NULL;
break;
case DETAIL_MAP:
hasDetailTexture = false;
detailTexture.source = NULL;
break;
case GLOSS_MAP:
hasGlossTexture = false;
glossTexture.source = NULL;
break;
case GLOW_MAP:
hasGlowTexture = false;
glowTexture.source = NULL;
break;
case BUMP_MAP:
hasBumpMapTexture = false;
bumpMapTexture.source = NULL;
break;
case DECAL_0_MAP:
hasDecal0Texture = false;
decal0Texture.source = NULL;
break;
case DECAL_1_MAP:
hasDecal1Texture = false;
decal1Texture.source = NULL;
break;
};
}
}
}
void NiTexturingProperty::SetShaderTextureCount( int new_count ) {
//Resize array
shaderTextures.resize( new_count );
}
void NiTexturingProperty::SetTexture( int n, TexDesc & new_val ) {
//Make sure index is not out of range
if ( n < 0 || n > int(textureCount) ) {
throw runtime_error("SetTexture - Index out of range. Call SetTextureCount to resize.");
}
//TODO: Create a built in type for this array of textures so it can be a real array again?
//Copy the values to the right texture
switch (n) {
case BASE_MAP:
baseTexture = new_val;
break;
case DARK_MAP:
darkTexture = new_val;
break;
case DETAIL_MAP:
detailTexture = new_val;
break;
case GLOSS_MAP:
glossTexture = new_val;
break;
case GLOW_MAP:
glowTexture = new_val;
break;
case BUMP_MAP:
bumpMapTexture = new_val;
break;
case DECAL_0_MAP:
decal0Texture = new_val;
break;
case DECAL_1_MAP:
decal1Texture = new_val;
break;
};
}
void NiTexturingProperty::SetShaderTexture( int n, TexDesc & new_val ) {
//Make sure index is not out of range
if ( n < 0 || n > int(shaderTextures.size()) ) {
throw runtime_error("SetShaderTexture - Index out of range. Call SetShaderTextureCount to resize.");
}
//Copy the values
shaderTextures[n].textureData = new_val;
}
......@@ -30,6 +30,105 @@ public:
virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> & link_stack, unsigned int version, unsigned int user_version );
virtual list<NiObjectRef> GetRefs() const;
virtual const Type & GetType() const;
/*! Retrieves the number of texture slots defined by this texturing propery. Texture slots may or may not actually contain textures, but each slot has a different meaning so the way a texture is used is dependant upon which slot it is in.
* \return The number of texture slots defined by this texturing property.
* \sa ITexturingProperty::SetTextureCount
*/
int GetTextureCount() const;
/*! Sets the number of texture slots defined by this texturing propery. Known valid values are 7 and 8.
* \param n The new size of the texture slot array.
* \sa ITexturingProperty::GetTextureCount
*/
void SetTextureCount( int new_count );
/*! Retrieves the number of extra texture slots defined by this texturing propery. These only exist in later Nif versions and their function is unknown.
* \return The number of extra texture slots defined by this texturing property.
* \sa ITexturingProperty::SetExtraTextureCount
*/
int GetShaderTextureCount() const;
/*! Sets the number of extra texture slots defined by this texturing propery. Often zero.
* \param n The new size of the extra texture slot array.
* \sa ITexturingProperty::GetExtraTextureCount
*/
void SetShaderTextureCount( int new_count );
/*! Retrieves the current apply mode for this texturing propery. This enum value affects the way the textures will be drawn.
* \return The current apply mode for this texturing property.
* \sa ITexturingProperty::SetApplyMode
*/
ApplyMode GetApplyMode() const;
/*! Sets the current apply mode for this texturing propery. This enum value affects the way the textures will be drawn.
* \param new_val The new apply mode for this texturing property.
* \sa ITexturingProperty::GetApplyMode
*/
void SetApplyMode( ApplyMode new_val );
/*! Retrieves the texture desription structure that describes a texture by slot number. The TexType enum is provided to make it easy to select the texture slot with the specific qualities that you want.
* \param n The slot number of the texture to get the texture description of. This is a positive zero based index that must be less than the value returned by ITexturingProperty::GetTextureCount.
* \sa ITexturingProperty::SetTexture, TexType
*/
TexDesc GetTexture( int n ) const;
/*! Sets a new description for the texture in the given slot number. The TexType enum is provided to make it easy to select the texture slot with the specific qualities that you want.
* \param n The slot number of the texture to set the texture description of. This is a positive zero based index that must be less than the value returned by ITexturingProperty::GetTextureCount.
* \param new_val Thew new texture descriptoin for the texture at the given slot number.
* \sa ITexturingProperty::GetTexture, TexType
*/
void SetTexture( int n, TexDesc & new_val );
/*! Retrieves the texture desription structure that describes an extra texture by slot number. These only exist in the later Nif versions and their function is unknown.
* \param n The slot number of the extra texture to get the texture description of. This is a positive zero based index that must be less than the value returned by ITexturingProperty::GetExtraTextureCount.
* \sa ITexturingProperty::SetExtraTexture
*/
TexDesc GetShaderTexture( int n ) const;
/*! Sets a new description for the texture in the given slot number. These only exist in the later Nif versions and their function is unknown.
* \param n The slot number of the extra texture to set the texture description of. This is a positive zero based index that must be less than the value returned by ITexturingProperty::GetTextureCount.
* \param new_val Thew new texture descriptoin for the extra texture at the given slot number.
* \sa ITexturingProperty::GetTexture, TexType
*/
void SetShaderTexture( int n, TexDesc & new_val );
/*! Retrieves the bump map luma offset. This is only relevant if a texture is defined in the BUMP_MAP texture slot. The function of this is unknown.
* \return The bump map luma offset.
* \sa ITexturingProperty::SetLumaOffset
*/
float GetLumaOffset() const;
/*! Sets the bump map luma offset. This is only relevant if a texture is defined in the BUMP_MAP texture slot. The function of this is unknown.
* \param new_val The new bump map luma offset.
* \sa ITexturingProperty::GetLumaOffset
*/
void SetLumaOffset( float new_val );
/*! Retrieves the bump map luma scale. This is only relevant if a texture is defined in the BUMP_MAP texture slot. The function of this is unknown.
* \return The bump map luma scale.
* \sa ITexturingProperty::SetLumaScale
*/
float GetLumaScale() const;
/*! Sets the bump map luma scale. This is only relevant if a texture is defined in the BUMP_MAP texture slot. The function of this is unknown.
* \param new_val The new bump map luma scale.
* \sa ITexturingProperty::GetLumaScale
*/
void SetLumaScale( float new_val );
/*! Retrieves the bump map matrix. This is only relevant if a texture is defined in the BUMP_MAP texture slot. The function of this is unknown.
* \return the bump map matrix.
* \sa ITexturingProperty::SetBumpMapMatrix
*/
Matrix22 GetBumpMapMatrix() const;
/*! Sets the bump map matrix. This is only relevant if a texture is defined in the BUMP_MAP texture slot. The function of this is unknown.
* \param new_val The new bump map matrix.
* \sa ITexturingProperty::GetBumpMapMatrix
*/
void SetBumpMapMatrix( Matrix22 & new_val );
protected:
NI_TEXTURING_PROPERTY_MEMBERS
};
......
pch.h 0 → 100644
//Headers to pre-compile
#include "NIF_IO.h"
#include "nif_math.h"
#include "niflib.h"
#include "Ref.h"
#include "Type.h"
#include "gen/AVObject.h"
#include "gen/Bones.h"
#include "gen/BoundingBox.h"
#include "gen/ByteArray.h"
#include "gen/ControllerLink.h"
#include "gen/Footer.h"
#include "gen/FurniturePosition.h"
#include "gen/Header.h"
#include "gen/hkTriangle.h"
#include "gen/KeyGroup.h"
#include "gen/LimitedHingeDescriptor.h"
#include "gen/LODRange.h"
#include "gen/MatchGroup.h"
#include "gen/MipMap.h"
#include "gen/Morph.h"
#include "gen/NodeGroup.h"
#include "gen/obj_defines.h"
#include "gen/Particle.h"
#include "gen/QuaternionXYZW.h"
#include "gen/RagDollDescriptor.h"
#include "gen/RotationKeyArray.h"
#include "gen/ShaderTexDesc.h"
#include "gen/ShortString.h"
#include "gen/SkinData.h"
#include "gen/SkinPartition.h"
#include "gen/SkinShape.h"
#include "gen/SkinShapeGroup.h"
#include "gen/SkinWeight.h"
#include "gen/StringPalette.h"
#include "gen/TBC.h"
#include "gen/TexDesc.h"
#include "gen/TexSource.h"
#include "obj/AbhkConstraint.h"
#include "obj/AbhkRagdollConstraint.h"
#include "obj/AbhkShapeCollection.h"
#include "obj/ABoneLODController.h"
#include "obj/AKeyedData.h"
#include "obj/AParticleModifier.h"
#include "obj/APSysCtlr.h"
#include "obj/APSysData.h"
#include "obj/AvoidNode.h"
#include "obj/bhkBlendCollisionObject.h"
#include "obj/bhkBlendController.h"
#include "obj/bhkBoxShape.h"
#include "obj/bhkCapsuleShape.h"
#include "obj/bhkCollisionObject.h"
#include "obj/bhkConvexShape.h"
#include "obj/bhkConvexTransformShape.h"
#include "obj/bhkConvexVerticesShape.h"
#include "obj/bhkEntity.h"
#include "obj/bhkHingeConstraint.h"
#include "obj/bhkLimitedHingeConstraint.h"
#include "obj/bhkListShape.h"
#include "obj/bhkMalleableConstraint.h"
#include "obj/bhkMoppBvTreeShape.h"
#include "obj/bhkMultiSphereShape.h"
#include "obj/bhkNiTriStripsShape.h"
#include "obj/bhkPackedNiTriStripsShape.h"
#include "obj/bhkPrismaticConstraint.h"
#include "obj/bhkRagdollConstraint.h"
#include "obj/bhkRefObject.h"
#include "obj/bhkRigidBody.h"
#include "obj/bhkRigidBodyT.h"
#include "obj/bhkSerializable.h"
#include "obj/bhkShape.h"
#include "obj/bhkSimpleShapePhantom.h"
#include "obj/bhkSPCollisionObject.h"
#include "obj/bhkSphereRepShape.h"
#include "obj/bhkSphereShape.h"
#include "obj/bhkStiffSpringConstraint.h"
#include "obj/bhkTransformShape.h"
#include "obj/bhkWorldObject.h"
#include "obj/BSBound.h"
#include "obj/BSFurnitureMarker.h"
#include "obj/BSKeyframeController.h"
#include "obj/BSParentVelocityModifier.h"
#include "obj/BSPSysArrayEmitter.h"
#include "obj/BSXFlags.h"
#include "obj/FxButton.h"
#include "obj/FxRadioButton.h"
#include "obj/FxWidget.h"
#include "obj/hkPackedNiTriStripsData.h"
#include "obj/NiAlphaController.h"
#include "obj/NiAlphaProperty.h"
#include "obj/NiAmbientLight.h"
#include "obj/NiAutoNormalParticles.h"
#include "obj/NiAutoNormalParticlesData.h"
#include "obj/NiAVObject.h"
#include "obj/NiBillboardNode.h"
#include "obj/NiBinaryExtraData.h"
#include "obj/NiBlendBoolInterpolator.h"
#include "obj/NiBlendFloatInterpolator.h"
#include "obj/NiBlendInterpolator.h"
#include "obj/NiBlendPoint3Interpolator.h"
#include "obj/NiBlendTransformInterpolator.h"
#include "obj/NiBoneLODController.h"
#include "obj/NiBoolData.h"
#include "obj/NiBooleanExtraData.h"
#include "obj/NiBoolInterpolator.h"
#include "obj/NiBoolTimelineInterpolator.h"
#include "obj/NiBSAnimationNode.h"
#include "obj/NiBSBoneLODController.h"
#include "obj/NiBSPArrayController.h"
#include "obj/NiBSParticleNode.h"
#include "obj/NiBSplineBasisData.h"
#include "obj/NiBSplineCompFloatInterpolator.h"
#include "obj/NiBSplineCompPoint3Interpolator.h"
#include "obj/NiBSplineCompTransformInterpolator.h"
#include "obj/NiBSplineData.h"
#include "obj/NiBSplineInterpolator.h"
#include "obj/NiCamera.h"
#include "obj/NiCollisionData.h"
#include "obj/NiCollisionObject.h"
#include "obj/NiColorData.h"
#include "obj/NiColorExtraData.h"
#include "obj/NiControllerManager.h"
#include "obj/NiControllerSequence.h"
#include "obj/NiDefaultAVObjectPalette.h"
#include "obj/NiDirectionalLight.h"
#include "obj/NiDitherProperty.h"
#include "obj/NiDynamicEffect.h"
#include "obj/NiExtraData.h"
#include "obj/NiFlipController.h"
#include "obj/NiFloatData.h"
#include "obj/NiFloatExtraData.h"
#include "obj/NiFloatExtraDataController.h"
#include "obj/NiFloatInterpolator.h"
#include "obj/NiFloatsExtraData.h"
#include "obj/NiFogProperty.h"
#include "obj/NiGeomMorpherController.h"
#include "obj/NiGravity.h"
#include "obj/NiIntegerExtraData.h"
#include "obj/NiIntegersExtraData.h"
#include "obj/NiInterpolator.h"
#include "obj/NiKeyframeController.h"
#include "obj/NiKeyframeData.h"
#include "obj/NiLight.h"
#include "obj/NiLightColorController.h"
#include "obj/NiLightDimmerController.h"
#include "obj/NiLODNode.h"
#include "obj/NiLookAtController.h"
#include "obj/NiLookAtInterpolator.h"
#include "obj/NiMaterialColorController.h"
#include "obj/NiMaterialProperty.h"
#include "obj/NiMeshParticleSystem.h"
#include "obj/NiMeshPSysData.h"
#include "obj/NiMorphData.h"
#include "obj/NiMultiTargetTransformController.h"
#include "obj/NiNode.h"
#include "obj/NiObject.h"
#include "obj/NiObjectNET.h"
#include "obj/NiPalette.h"
#include "obj/NiParticleBomb.h"
#include "obj/NiParticleColorModifier.h"
#include "obj/NiParticleGrowFade.h"
#include "obj/NiParticleMeshes.h"
#include "obj/NiParticleMeshesData.h"
#include "obj/NiParticleMeshModifier.h"
#include "obj/NiParticleRotation.h"
#include "obj/NiParticles.h"
#include "obj/NiParticlesData.h"
#include "obj/NiParticleSystem.h"
#include "obj/NiParticleSystemController.h"
#include "obj/NiPathController.h"
#include "obj/NiPathInterpolator.h"
#include "obj/NiPixelData.h"
#include "obj/NiPlanarCollider.h"
#include "obj/NiPoint3Interpolator.h"
#include "obj/NiPointLight.h"
#include "obj/NiPosData.h"
#include "obj/NiProperty.h"
#include "obj/NiPSysAgeDeathModifier.h"
#include "obj/NiPSysBombModifier.h"
#include "obj/NiPSysBoundUpdateModifier.h"
#include "obj/NiPSysBoxEmitter.h"
#include "obj/NiPSysColliderManager.h"
#include "obj/NiPSysColorModifier.h"
#include "obj/NiPSysCylinderEmitter.h"
#include "obj/NiPSysData.h"
#include "obj/NiPSysDragModifier.h"
#include "obj/NiPSysEmitter.h"
#include "obj/NiPSysEmitterCtlr.h"
#include "obj/NiPSysEmitterCtlrData.h"
#include "obj/NiPSysEmitterDeclinationCtlr.h"
#include "obj/NiPSysEmitterDeclinationVarCtlr.h"
#include "obj/NiPSysEmitterInitialRadiusCtlr.h"
#include "obj/NiPSysEmitterLifeSpanCtlr.h"
#include "obj/NiPSysEmitterSpeedCtlr.h"
#include "obj/NiPSysGravityModifier.h"
#include "obj/NiPSysGravityStrengthCtlr.h"
#include "obj/NiPSysGrowFadeModifier.h"
#include "obj/NiPSysMeshEmitter.h"
#include "obj/NiPSysMeshUpdateModifier.h"
#include "obj/NiPSysModifier.h"
#include "obj/NiPSysModifierActiveCtlr.h"
#include "obj/NiPSysPlanarCollider.h"
#include "obj/NiPSysPositionModifier.h"
#include "obj/NiPSysResetOnLoopCtlr.h"
#include "obj/NiPSysRotationModifier.h"
#include "obj/NiPSysSpawnModifier.h"
#include "obj/NiPSysSphereEmitter.h"
#include "obj/NiPSysUpdateCtlr.h"
#include "obj/NiPSysVolumeEmitter.h"
#include "obj/NiRangeLODData.h"
#include "obj/NiRotatingParticles.h"
#include "obj/NiRotatingParticlesData.h"
#include "obj/NiScreenLODData.h"
#include "obj/NiSequenceStreamHelper.h"
#include "obj/NiShadeProperty.h"
#include "obj/NiSingleInterpolatorController.h"
#include "obj/NiSkinData.h"
#include "obj/NiSkinInstance.h"
#include "obj/NiSkinPartition.h"
#include "obj/NiSourceTexture.h"
#include "obj/NiSpecularProperty.h"
#include "obj/NiSphericalCollider.h"
#include "obj/NiSpotLight.h"
#include "obj/NiStencilProperty.h"
#include "obj/NiStringExtraData.h"
#include "obj/NiStringPalette.h"
#include "obj/NiStringsExtraData.h"
#include "obj/NiTextKeyExtraData.h"
#include "obj/NiTextureEffect.h"
#include "obj/NiTextureTransformController.h"
#include "obj/NiTexturingProperty.h"
#include "obj/NiTimeController.h"
#include "obj/NiTransformController.h"
#include "obj/NiTransformData.h"
#include "obj/NiTransformInterpolator.h"
#include "obj/NiTriBasedGeom.h"
#include "obj/NiTriBasedGeomData.h"
#include "obj/NiTriShape.h"
#include "obj/NiTriShapeData.h"
#include "obj/NiTriStrips.h"
#include "obj/NiTriStripsData.h"
#include "obj/NiUVController.h"
#include "obj/NiUVData.h"
#include "obj/NiVectorExtraData.h"
#include "obj/NiVertexColorProperty.h"
#include "obj/NiVertWeightsExtraData.h"
#include "obj/NiVisController.h"
#include "obj/NiVisData.h"
#include "obj/NiWireframeProperty.h"
#include "obj/NiZBufferProperty.h"
#include "obj/RootCollisionNode.h"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment