selecting surfaces, vertices, and lines

Blitz3D Forums/Blitz3D Programming/selecting surfaces, vertices, and lines

Picklesworth(Posted 2004) [#1]
Uh, solved the original problem, but how can I find out what vertices are around a particular polygon?
Oh, and how can I change the colour of a particular triangle?


jfk EO-11110(Posted 2004) [#2]
You can chanche the color of a triangle with the vertex colors (make sure your docs are up to date, it's one of the newer features), but if you want to leave all other triangles unaltered, the mesh should use unshared vertices.

for the other question, i think there's a command named TriangleVertex...


Picklesworth(Posted 2004) [#3]
I tried your suggestions, and I think it should work. It's probably quite obvious what I'm doing wrong, but I'm inexperianced with vertex colouring. The vertex selecting seems to work, according to a simple test I ran, but I can't see their colours with the vertex colouring. Can you help me please? Am I supposed to set up the 3d model for vertex colouring?


	;selecting polygons	
;NOTE: CURRENTLY, YOU CAN ONLY SUPPORT SELECTION OF SINGLE OBJECTS BECAUSE THE PICKED POLYGON IS 
;STORED IN A VARIABLE. MAKE THE BELOW VARIABLE AN ARRAY OR DATABANK OR TYPE INSTANCE
		
	If MouseDown(1) ;if the user left clicks
			
		;camera click where the mouse is to selec the vertex
		CameraPick camera,MouseX(),MouseY()
		
		;check if a proper entity is being clicked on. 
		;Without this, you'll get a memory access violation
		If Not PickedEntity() = 0
		
			;save the picked triangle in a variable
			;NOTE: THIS IS WHAT YOU WOULD ALTER TO ALLOW FOR MULTIPLE SELECTIONS...
			tri = PickedTriangle()	
				
			;find the picked surface to allow for vertex finding
			surface = PickedSurface()
		
			;find vertices attached to the selected surface
			;NOTE: this section should be moved out of here and in to where it's used
			;otherwise you'll have to go through piles of junk with storing this for no reason
			tri_vertex0 = TriangleVertex(surface,tri,0)
			tri_vertex1 = TriangleVertex(surface,tri,1)
			tri_vertex2 = TriangleVertex(surface,tri,2)
			
			;the the vertex colouring. Deosn't work yet...
			;FIX THIS YOU IMBECILE, DYLAN
			VertexColor surface,tri_vertex0,255,0,0,1
			VertexColor surface,tri_vertex1,255,0,0,1
			VertexColor surface,tri_vertex2,255,0,0,1
			
		EndIf
				
	EndIf
	

Erm, I hope you don't mind my methods of making a todo list. The more of those mean comments I remove, the happier I am; it's quite effective actually.


jfk EO-11110(Posted 2004) [#4]
You need to set

EntityPickmode mesh,2
EntityFX mesh,2

for the entities you want to paint using Vertex colors.


Picklesworth(Posted 2004) [#5]
oh my gahhh! It was working all along, but I was viewing in wireframe. Is there a way I can make the vertex colouring visible in wireframe? Also, how do I "unshare vertices" on a mesh?
Thanks for the help before now...


jfk EO-11110(Posted 2004) [#6]
No idea about the wireframe thing, but to unshare or unweld a mesh, you can produce a copy by parsing all tris and create a triangle with 3 completely new vertices in the clone mesh. You could then save the mesh using one of the Mesh Export Sources seen in the Code Archives.