我编辑了这篇文章,以使其更加清晰.
好吧,我在这里要做的是表示由8个不同三角形组成的图块.每个三角形应该能够独立地改变它的颜色.
所以,我遇到的问题是,当我改变单个三角形的颜色时,它会改变线条的颜色,正如你在第二张图片中看到的那样.
这是创建磁贴的代码:
var tile=[];
var n=0;
for(var i=0; i<4; i++){
for(var j=0; j<2; j++){
var triangle = new THREE.Object3D();
var lineMaterial = new THREE.LineBasicMaterial({color:0xffffff, transparent:true, opacity:0.5});
var triangleMaterial = new THREE.MeshPhongMaterial({color:COLOR_OFF ,emissive:EMISSIVE_OFF ,side:THREE.DoubleSide, shading:THREE.FlatShading});
var geometry = new THREE.Geometry();
geometry.vertices.push( triangleVectors[j][0], triangleVectors[j][1], triangleVectors[j][2] );
var face = new THREE.Face3(0, 1, 2);
geometry.faces.push(face);
triangle.add(new THREE.LineSegments(new THREE.Geometry(), lineMaterial));
triangle.add( new THREE.Mesh( new THREE.Geometry(), triangleMaterial));
triangle.children[ 0 ].geometry = new THREE.WireframeGeometry(geometry);
triangle.children[ 1 ].geometry = geometry;
triangle.rotation.z = Math.PI*i/2;
triangle.position.x = …Run Code Online (Sandbox Code Playgroud) 我正在尝试测试我用googletest编写的电机控制库,但我不是要编译测试代码.测试位于名为test.cpp的文件中,如下所示:
#include <gtest/gtest.h>
#include "../motor.hpp"
TEST(constructorTest, contructorDefault)
{
}
Run Code Online (Sandbox Code Playgroud)
我将测试主函数放在另一个名为main.cpp的文件中.
#include <gtest/gtest.h>
#include "../motor.hpp"
int main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc,argv);
RUN_ALL_TESTS();
}
Run Code Online (Sandbox Code Playgroud)
要编译我已经完成了以下行:
g++ main.cpp test.cpp ../motor.cpp -o test
Run Code Online (Sandbox Code Playgroud)
我得到的结果是:
main.cpp:8:17: warning: ignoring return value of ‘int RUN_ALL_TESTS()’, declared with attribute warn_unused_result [-Wunused-result]
RUN_ALL_TESTS();
^
/tmp/ccZ5BaBH.o: In function `main':
main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleTest(int*, char**)'
/tmp/ccZ5BaBH.o: In function `RUN_ALL_TESTS()':
main.cpp:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x5): undefined reference to `testing::UnitTest::GetInstance()'
main.cpp:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0xd): undefined reference to `testing::UnitTest::Run()'
/tmp/ccFuAMp3.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x5c): undefined reference to `testing::internal::GetTestTypeId()' …Run Code Online (Sandbox Code Playgroud)