Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Reload textures
Topic Started: Nov 10 2007, 05:34 PM (518 Views)
Gompen
Advanced Member
[ *  *  * ]
how do i reload the texture of a 3ds model? since i change it during the game
Thanks for all the help..
Isis Developer
Offline Profile Quote Post Goto Top
 
Zip
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Maybe adding this in your event?
Code:
 

Destroy()
LoadMesh()
Sorry if i've made some errors, I'm not english!
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
No that didn't work, it removed the model... without creating it agian
Isis Developer
Offline Profile Quote Post Goto Top
 
Ruud v A
Member Avatar
Programmer · Artist
[ *  *  *  *  * ]
I heard dr. Best saying once that u3d never loads a texture twice... I don't know if this is even possible...

Veniogames
Vēnit, ut mē occidĕret.

I will not use Ultimate3d 2.x.x anymore - I am an Ogre C++ programmer.
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
Lol :P but i have to get it :P
Isis Developer
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Use ReleaseModel() to release the model completely, after destroying it. Then use LoadMesh(...) to load it again. This should be working. In code this is:
Code:
 
// Create event
file="models/model.3ds";
LoadMesh();

// On reload
Destroy();
ReleaseModel(file);
LoadMesh();
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
No it still doesnt work.. The format i load is bmp i do it just useing LoadMesh
and here are some pics to show what happends
Working
Posted Image
Not Working
Posted Image

Is all hope lost ? :sad:
Isis Developer
Offline Profile Quote Post Goto Top
 
zelda4evr
Member Avatar
Forum God
[ *  *  *  *  *  * ]
how are you chaging it in game? and could you show us some of your code?

Posted Image
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
Create of the model file (obj_bp_face)
Code:
 

file='models\c3face.3ds'
frame=1
z=0
LoadMesh();
RecalculateNormals();
SmoothNormals();
scalx=1;
scaly=scalx;
scalz=scalx;
x=21
y=75
z=2

Step event of camera (the one that changes it
Code:
 

if(MouseCheckButton(mb_left)) then {
GetMousePos();
// Get the mouse position relative to the center of the first view
// and scale it to the (vertical) range from -1 to 1
RelMouseX=(global.mouse_x-(view_xview[0]+view_wview[0]/2))/(view_hview[0]/2);
RelMouseY=(global.mouse_y-(view_yview[0]+view_hview[0]/2))/(view_hview[0]/2);
// Calculate the (relative) distance of the viewpoint to the viewplane
ViewPlaneDist=1/tan(degtorad(view/4));
// Calculate the Longitude and Latitude parameter values for the
// GetDistanceToModel(...) function
Angle=degtorad(rotx)+arctan2(RelMouseY,ViewPlaneDist);
Hypotenuse=sqrt(sqr(RelMouseY)+sqr(ViewPlaneDist));
Length=Hypotenuse*cos(Angle);
rotyAdd=arctan2(RelMouseX,Length);
diry=roty+radtodeg(rotyAdd);
RelHeight=Hypotenuse*sin(Angle);
Hypotenuse=sqrt(sqr(RelMouseX)+sqr(Length));
dirx=radtodeg(arctan2(RelHeight,Hypotenuse));
// Find the point on the object that the mouse is over
distance1=GetDistanceToModel(obj_bp_face.id,x,y,z+height,dirx,diry);
distance2=GetDistanceToModel(obj_bp_hair.id,x,y,z+height,dirx,diry);
distance3=GetDistanceToModel(obj_bp_clothes.id,x,y,z+height,dirx,diry);
distance4=GetDistanceToModel(obj_bp_legs.id,x,y,z+height,dirx,diry);
distance5=GetDistanceToModel(obj_bp_shoes.id,x,y,z+height,dirx,diry);
mindis=min(distance1,distance2,distance3,distance4,distance5);
if(mindis<1000) then {
if(mindis=distance1) then {
curcol1+=1
bodypart=1
defcol[10]=lcol[1,6];
surf=surface_create(256,256);
surface_set_target(surf);
draw_set_color(c_black);
draw_rectangle(0,0,256,256,false);
draw_set_color(c_white);
for(i=0; i<11; i+=1) {
draw_sprite_ext(img[i],0,0,0,1,1,0,defcol[i],1);
draw_set_color(c_white);
}
surface_save(surf,"gfx\mariouvm.bmp");
surface_free(surf);
surface_reset_target();
with(obj_bp_face) {
Destroy();
ReleaseModel(file);
LoadMesh();
}
}
}


if you want the gmk or some more code please ask
Isis Developer
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
Somehow, I doubt surfaces will work on Ultimate3D.
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
It works perfectly.. But maybe it disables some of the functions u3d use
Still none that knows?
Isis Developer
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
Help :huh:
I've tried all i can think of but none works
Isis Developer
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
Maybe you have multiple characters in your game that use the same model? In that case ReleaseModel(file) won't work if there are still objects using that model, so you would have to destroy those as well first.
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
Hm, no i dont think so.. :huh:
But i uploaded my problem here
http://www.savefile.com/files/1190199
It would mean so much to me if some of you wpuld take a look at it
Isis Developer
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
I solved the mystery of the disappearing head :D!
Actually it was never really gone, it's just that after reloading the model, Step() needed to do its job before it became visible. Because no variables changed, the script doesn't do anything, so you have to force it into action by changing one of the "previous..." variables, like previousx2.
So use the following to fix the problem :):
Code:
 
with(obj_bp_face) {
Destroy();
ReleaseModel(file);
LoadMesh();
previousx2=0;//needs to be different from x value to force Step() to update the model
}
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
Go to Next Page
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply