[Bf-cycles] Assign shader to a mesh
Mohamed Sakr
3dsakr at gmail.com
Sat Nov 14 15:34:34 CET 2015
not sure, try to use mesh->reserve and mesh->set_triangle
On Sat, Nov 14, 2015 at 3:43 PM, haggi krey <haggi at haggi.de> wrote:
> Hi,
>
> following the standalone xml reader, I tried to create a shader and
> assign it to my mesh.
> Is it correct that I add the index of the shader in the scene->shaders
> array to the mesh and to the created triangle?
>
> For some reason I get an vector error in util_vector.h if I do it this
> way. ShaderId is set to my self created shader which can be found in the
> scene at index 4:
>
> Mesh *mesh = new Mesh();
> scene->meshes.push_back(mesh);
> Object *object = new Object();
> object->mesh = mesh;
> Transform tfm = transform_identity();
> object->tfm = tfm;
> scene->objects.push_back(object);
> mesh->used_shaders.push_back(shaderId);
>
> vector<float3> P;
> float3 p0 = { -1, -1, 0 };
> float3 p1 = { -1, 1, 0 };
> float3 p2 = { 1, 1, 0 };
> P.push_back(p0);
> P.push_back(p1);
> P.push_back(p2);
> mesh->verts = P;
> mesh->add_triangle(0, 1, 2, shaderId, true);
>
> Any idea what could be wrong here?
>
> haggi
>
>
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> http://lists.blender.org/mailman/listinfo/bf-cycles
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20151114/8ad91061/attachment.htm
More information about the Bf-cycles
mailing list