[Bf-blender-cvs] [28869a2] cycles-ptex-19: Add some Ptex types to Mesh SDNA

Nicholas Bishop noreply at git.blender.org
Wed Jan 28 19:40:08 CET 2015


Commit: 28869a2107e441775d529debfb745dff42441bb8
Author: Nicholas Bishop
Date:   Mon Jan 19 15:59:28 2015 +0100
Branches: cycles-ptex-19
https://developer.blender.org/rB28869a2107e441775d529debfb745dff42441bb8

Add some Ptex types to Mesh SDNA

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

M	source/blender/makesdna/DNA_meshdata_types.h

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

diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 3304980..0de806b 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -280,6 +280,70 @@ typedef struct MVertSkin {
 	int flag;
 } MVertSkin;
 
+typedef enum PtexDataType {
+	MPTEX_DATA_TYPE_UINT8  =  0,
+	MPTEX_DATA_TYPE_UINT16 =  1,
+	/* Reserved for compatibility with Ptex file format
+	 * specification */
+	/* MPTEX_DATA_TYPE_FLOAT16 = 2, */
+	MPTEX_DATA_TYPE_FLOAT32 = 3,
+} PtexDataType;
+
+typedef struct MPtexTexelInfo {
+	unsigned char num_channels;
+
+	/* enum PtexDataType */
+	unsigned char data_type;
+
+	unsigned char pad[2];
+} MPtexTexelInfo;
+
+
+typedef struct MPtexLogRes {
+	unsigned char u;
+	unsigned char v;
+
+	unsigned char pad[2];
+} MPtexLogRes;
+
+/* Ptex texture data attached to mesh poly loops
+ *
+ * The texture is rectanglular (doesn't have to be square), and the
+ * number of pixels on each side must be a power of two. The number of
+ * texels in the texture is (2^logres.u * 2^logres.v).
+ *
+ * All channels have the same data type and resolution, so the rect
+ * array's length in bytes is:
+ *     num_texels *
+ *     texel_info.num_channels *
+ *     data_type_size_in_bytes
+ */
+typedef struct MLoopPtex {
+	/* TODO, shouldn't be in each loop? */
+	struct Image *image;
+
+	/* Channel data array */
+	void *rect;
+
+	MPtexLogRes logres;
+
+	int pad1;
+
+	/* TODO, shouldn't be in each loop */
+	MPtexTexelInfo texel_info;
+
+	int pad2;
+} MLoopPtex;
+
+typedef struct MLoopPtexUV {
+	float uv[2];
+	int id;
+} MLoopPtexUV;
+
+typedef struct MTessFacePtex {
+	struct MLoopPtexUV corners[4];
+} MTessFacePtex;
+
 typedef struct FreestyleEdge {
 	char flag;
 	char pad[3];




More information about the Bf-blender-cvs mailing list