Sign in to follow this  
vidalsasoon

HLSL files and absolute texture paths.

Recommended Posts

My effect files have params like: string ResourceName = "default_color.dds"; The problem is that if I want to use these files, I have to alter the ResourceName to an absolute path. This is extremely tedious. Is there anyway I could just leave my file paths as they are, leave the texture file in the same directory as the fx file and be happy? Thanks, V

Share this post


Link to post
Share on other sites
Good day Vidalsasoon,
How are you doing?

The Problem
Structure and absolute paths

The Solution
There are a couple of ways to do this.
1) You could prefix all the texture filenames with a path... Let's say you have a texture loader method you would just do,

const string texturePath = "Resources/textures";
void TextureLoader(IDirect3DDevice9* pDevice, string srcFilename)
{
D3DXCreateTextureFromFile(pDevice, texturePath + srcFilename);
}



Say may agree that this is ugly but it works and it's one way to resolve your problem.

Thing about this is that you don't want all your resources in one directory. This might become messy and unstructured.

Directory Structure example
-Resources
--textures
--models
--shaders

It makes things a little easier to manager in the long run.

Take care buddy, I hope this helps a bit.
PS: to answer your question, you could probably put everything in the debug/release directories and just use the filepaths you are using now :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this