[Bf-blender-cvs] [eb08d8e] cycles-ptex-06: Remove Ptex UV attribute from Cycles

Nicholas Bishop noreply at git.blender.org
Thu Jan 15 20:13:14 CET 2015


Commit: eb08d8ef245182b9ec718b833d874f095248471d
Author: Nicholas Bishop
Date:   Fri Jan 9 17:46:50 2015 +0100
Branches: cycles-ptex-06
https://developer.blender.org/rBeb08d8ef245182b9ec718b833d874f095248471d

Remove Ptex UV attribute from Cycles

To me it seems reasonable to just use regular UV attribute, probably I
miss something important though...

===================================================================

M	intern/cycles/blender/blender_mesh.cpp
M	intern/cycles/kernel/geom/geom_primitive.h
M	intern/cycles/kernel/kernel_types.h
M	intern/cycles/kernel/osl/osl_services.cpp
M	intern/cycles/render/attribute.cpp
M	intern/cycles/render/nodes.cpp
M	intern/cycles/subd/subd_dice.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index 4df5519..c3d95a7 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -360,7 +360,6 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 		//BL::Mesh::tessface_vertex_colors_iterator l;
 
 		Attribute *face_id_attr = mesh->attributes.add(ATTR_STD_PTEX_FACE_ID);
-		Attribute *uv_attr = mesh->attributes.add(ATTR_STD_PTEX_UV);
 		mesh->attributes.reserve();
 
 		float *face_id = face_id_attr->data_float();
@@ -510,8 +509,7 @@ static void create_subd_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, PointerR
 	sdmesh.finish();
 
 	/* parameters */
-	bool need_ptex = mesh->need_attribute(scene, ATTR_STD_PTEX_FACE_ID) ||
-	                 mesh->need_attribute(scene, ATTR_STD_PTEX_UV);
+	bool need_ptex = mesh->need_attribute(scene, ATTR_STD_PTEX_FACE_ID);
 
 	SubdParams sdparams(mesh, used_shaders[0], true, need_ptex);
 	sdparams.dicing_rate = RNA_float_get(cmesh, "dicing_rate");
diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h
index b52ec7e..b2b2804 100644
--- a/intern/cycles/kernel/geom/geom_primitive.h
+++ b/intern/cycles/kernel/geom/geom_primitive.h
@@ -84,20 +84,17 @@ ccl_device float3 primitive_uv(KernelGlobals *kg, ShaderData *sd)
 
 /* Ptex coordinates */
 
-ccl_device bool primitive_ptex(KernelGlobals *kg, ShaderData *sd, float2 *uv, int *face_id)
+ccl_device bool primitive_ptex(KernelGlobals *kg, ShaderData *sd, int *face_id)
 {
 	/* storing ptex data as attributes is not memory efficient but simple for tests */
-	AttributeElement elem_face_id, elem_uv;
+	AttributeElement elem_face_id;
 	int offset_face_id = find_attribute(kg, sd, ATTR_STD_PTEX_FACE_ID, &elem_face_id);
-	int offset_uv = find_attribute(kg, sd, ATTR_STD_PTEX_UV, &elem_uv);
 
-	if(offset_face_id == ATTR_STD_NOT_FOUND || offset_uv == ATTR_STD_NOT_FOUND)
+	if(offset_face_id == ATTR_STD_NOT_FOUND)
 		return false;
 
-	float3 uv3 = primitive_attribute_float3(kg, sd, elem_uv, offset_uv, NULL, NULL);
 	float face_id_f = primitive_attribute_float(kg, sd, elem_face_id, offset_face_id, NULL, NULL);
 
-	*uv = make_float2(uv3.x, uv3.y);
 	*face_id = (int)face_id_f;
 
 	return true;
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 77d3ea8..c0d90ca 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -528,7 +528,6 @@ typedef enum AttributeStandard {
 	ATTR_STD_PARTICLE,
 	ATTR_STD_CURVE_INTERCEPT,
 	ATTR_STD_PTEX_FACE_ID,
-	ATTR_STD_PTEX_UV,
 	ATTR_STD_VOLUME_DENSITY,
 	ATTR_STD_VOLUME_COLOR,
 	ATTR_STD_VOLUME_FLAME,
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index f0824db..ccdbc45 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -843,10 +843,9 @@ bool OSLRenderServices::texture(ustring filename, TextureOpt &options,
 #ifdef WITH_PTEX
 	/* todo: this is just a quick hack, only works with particular files and options */
 	if(string_endswith(filename.string(), ".ptx")) {
-		float2 uv;
 		int faceid;
 
-		if(!primitive_ptex(kg, sd, &uv, &faceid))
+		if(!primitive_ptex(kg, sd, &faceid))
 			return false;
 
 		float u = s;
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index 15d7134..b07399a 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -218,8 +218,6 @@ const char *Attribute::standard_name(AttributeStandard std)
 			return "curve_intercept";
 		case ATTR_STD_PTEX_FACE_ID:
 			return "ptex_face_id";
-		case ATTR_STD_PTEX_UV:
-			return "ptex_uv";
 		case ATTR_STD_VOLUME_DENSITY:
 			return "density";
 		case ATTR_STD_VOLUME_COLOR:
@@ -358,9 +356,6 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
 			case ATTR_STD_PTEX_FACE_ID:
 				attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_FACE);
 				break;
-			case ATTR_STD_PTEX_UV:
-				attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
-				break;
 			case ATTR_STD_GENERATED_TRANSFORM:
 				attr = add(name, TypeDesc::TypeMatrix, ATTR_ELEMENT_MESH);
 				break;
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 625b829..7c3e4b2 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -228,7 +228,6 @@ void ImageTextureNode::attributes(Shader *shader, AttributeRequestSet *attribute
 	if (shader->has_surface && string_endswith(filename, ".ptx")) {
 		/* ptex */
 		attributes->add(ATTR_STD_PTEX_FACE_ID);
-		attributes->add(ATTR_STD_PTEX_UV);
 	}
 #endif
 
@@ -417,7 +416,6 @@ void EnvironmentTextureNode::attributes(Shader *shader, AttributeRequestSet *att
 	if (shader->has_surface && string_endswith(filename, ".ptx")) {
 		/* ptex */
 		attributes->add(ATTR_STD_PTEX_FACE_ID);
-		attributes->add(ATTR_STD_PTEX_UV);
 	}
 #endif
 
diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp
index 44bab06..4a950c0 100644
--- a/intern/cycles/subd/subd_dice.cpp
+++ b/intern/cycles/subd/subd_dice.cpp
@@ -36,7 +36,6 @@ EdgeDice::EdgeDice(const SubdParams& params_)
 	params.mesh->attributes.add(ATTR_STD_VERTEX_NORMAL);
 
 	if(params.ptex) {
-		params.mesh->attributes.add(ATTR_STD_PTEX_UV);
 		params.mesh->attributes.add(ATTR_STD_PTEX_FACE_ID);
 	}
 }
@@ -68,14 +67,6 @@ int EdgeDice::add_vert(Patch *patch, float2 uv)
 	mesh_P[vert_offset] = P;
 	mesh_N[vert_offset] = N;
 
-	if(params.ptex) {
-		Attribute *attr_ptex_uv = params.mesh->attributes.add(ATTR_STD_PTEX_UV);
-		params.mesh->attributes.reserve();
-
-		float3 *ptex_uv = attr_ptex_uv->data_float3();
-		ptex_uv[vert_offset] = make_float3(uv.x, uv.y, 0.0f);
-	}
-
 	return vert_offset++;
 }




More information about the Bf-blender-cvs mailing list