We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Creating surface attribute

Lk_
Participant
Hello,

I'm trying to create new surfaces from scratch using custom textures (Basic Engine only).
So far I got through setting up the library folder for texture images and creating API_Texture attribute with API function. However, I'm constantly getting mixed results that seem to have something to do with API_Texture.status field.
For instance, if status == 0 no texture image is loaded. Different values produce different results with mirroring, alpha channel settings and so on.
Is there any reference on how does this thing work? Or is there any other, more 'proper' way of creating surfaces with API?

Also, how do I set the vectorial hatching for the surface?

Thanks.
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
akomporday
Graphisoft Alumni
Graphisoft Alumni
Hey,
Here are the possible values for the status field with a little explanation. Note that you can use multiple using binary operations (as you would with masks).


	#define	APITxtr_LinkMat			0x1000		/**< texture linked to a material	*/

	#define	APITxtr_MirrorY			0x0800		/**< mirrored in Y direction */
	#define	APITxtr_MirrorX			0x0400		/**< mirrored in X direction */
	#define	APITxtr_RandomShift		0x0200		/**< shifted randomly */

	#define	APITxtr_SurfacePattern	0x0100		/**< alpha channel changes the surface color of the texture */
	#define	APITxtr_AmbientPattern	0x0080		/**< alpha channel changes the ambient color of the texture */
	#define	APITxtr_SpecularPattern	0x0040		/**< alpha channel changes the specular color of the texture */
	#define	APITxtr_DiffusePattern	0x0020		/**< alpha channel changes the diffuse color of the texture */
	#define	APITxtr_BumpPattern		0x0010		/**< bump mapping or surface normal perturbation */
	#define	APITxtr_TransPattern	0x0008		/**< alpha channel changes the transparency of the texture */

	#define	APITxtr_FillRectNatur	0x0004		/**< fit the rectangle with the picture in a central position	*/
												/**< using the natural aspect ratio of the picture */
	#define	APITxtr_FitPictNatur	0x0002		/**< fit the the picture in the middle of the rectangle */
												/**< using the natural aspect ratio of the picture */
	#define	APITxtr_UseAlpha		0x0001		/**< use alpha channel */

View solution in original post

2 REPLIES 2
Solution
akomporday
Graphisoft Alumni
Graphisoft Alumni
Hey,
Here are the possible values for the status field with a little explanation. Note that you can use multiple using binary operations (as you would with masks).


	#define	APITxtr_LinkMat			0x1000		/**< texture linked to a material	*/

	#define	APITxtr_MirrorY			0x0800		/**< mirrored in Y direction */
	#define	APITxtr_MirrorX			0x0400		/**< mirrored in X direction */
	#define	APITxtr_RandomShift		0x0200		/**< shifted randomly */

	#define	APITxtr_SurfacePattern	0x0100		/**< alpha channel changes the surface color of the texture */
	#define	APITxtr_AmbientPattern	0x0080		/**< alpha channel changes the ambient color of the texture */
	#define	APITxtr_SpecularPattern	0x0040		/**< alpha channel changes the specular color of the texture */
	#define	APITxtr_DiffusePattern	0x0020		/**< alpha channel changes the diffuse color of the texture */
	#define	APITxtr_BumpPattern		0x0010		/**< bump mapping or surface normal perturbation */
	#define	APITxtr_TransPattern	0x0008		/**< alpha channel changes the transparency of the texture */

	#define	APITxtr_FillRectNatur	0x0004		/**< fit the rectangle with the picture in a central position	*/
												/**< using the natural aspect ratio of the picture */
	#define	APITxtr_FitPictNatur	0x0002		/**< fit the the picture in the middle of the rectangle */
												/**< using the natural aspect ratio of the picture */
	#define	APITxtr_UseAlpha		0x0001		/**< use alpha channel */
Lk_
Participant
That's exactly what I needed.

Thanks!