Jump to content

Recommended Posts

Posted

Hello,

I have a 3d object.I want to include this object to my program as mesh and create visualization of this object. But this object contains of some parts.(for example cube, sphere etc.) How i can to set different textures to different parts?

Please, help me.

Posted
PaintEntity( FindChild(model,"meshname"), LoadMaterial("abstract::matname.mat") );

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

PaintSurface might be what you want. Here's an example function that utilizes it (in Lua, but C would be basically the same):

 

function makeUniqueMesh(ent, meshname)
local orig_mesh = ent:FindChild(meshname)
local new_mesh = CreateMesh(ent)

for surface_index=1, orig_mesh:CountSurfaces() do
	local orig_surface = ent:FindChild(meshname):GetSurface(surface_index)
	local new_surface = CreateSurface(new_mesh)

	for i=1, orig_surface:CountVertices() do
		new_surface:AddVertex(orig_surface:GetVertexPosition(i-1), orig_surface:GetVertexNormal(i-1), orig_surface:GetVertexTexCoords(i-1,0))
	end

	for i=1, orig_surface:CountTriangles() do
		new_surface:AddTriangle(orig_surface:TriangleVertex(i-1, 0), orig_surface:TriangleVertex(i-1, 1), orig_surface:TriangleVertex(i-1, 2))
	end

	PaintSurface(new_surface, GetSurfaceMaterial(orig_surface))
end

new_mesh:SetPosition(orig_mesh:GetPosition(1),1)
new_mesh:SetRotation(orig_mesh:GetRotation(1),1)
HideEntity(orig_mesh)
UpdateMesh(new_mesh)

return new_mesh

end

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...